h1 h2 plugin for wordpress???

4 replies
  • SEO
  • |
I could have sworn there was a great plugin for this.....

Does anyone have a direct link or the exact name of a plug in that lets you manipulate this post by post?

Thanks in advance.

AW888
#plugin #wordpress
  • Profile picture of the author vema123
    Do you mean the h1h2 plugin which can make your h1 and h2 invisible for the users' eyes? I don't know the name of the plugin, but I got it from a friend who was also passed from someone else recently, and I'm not sure if this is what you want. I personally NEVER use this php plugin. So I have no idea if it even works or not. Feel free to copy:

    --------------------------------------------

    <?php

    if (!class_exists('h1h2_tags')) {





    class h1h2_tags {

    function install() {

    }

    function uninstall() {

    }

    function onAdminMenuH1H2() {
    //add_submenu_page('options-general.php', 'H1-H2 contents', 'H1-H2 contents', 10, basename(__FILE__), array(&$this, 'display_fields'));

    if ( function_exists('add_meta_box') ) {
    add_meta_box('vlnt_h1h2_extradiv', 'H1-H2 contents', array(&$this, 'display_fields'), 'post');
    add_meta_box('vlnt_h1h2_extradiv', 'H1-H2 contents', array(&$this, 'display_fields'), 'page');
    } else {
    add_action('dbx_post_advanced', array(&$this, 'display_fields'));
    add_action('dbx_page_advanced', array(&$this, 'display_fields'));
    }
    }

    function display_fields() {
    global $post;

    $h1h2_tags = get_post_meta($post->ID,'vlnt_h1h2_tags',true);
    if ($h1h2_tags) {
    $already_used = true;

    preg_match("~<h1[^>]+>([^<]+)</h1>.*?<h2[^>]+>([^<]+)</h2>~",$h1h2_tags,$matches);

    if ( is_array($matches) && count($matches)>0 ) {
    $h1_tag = $matches[1];
    $h2_tag = $matches[2];
    } else {
    $h1_tag = '';
    $h2_tag = '';
    }

    } else {
    $already_used = false;
    $h1_tag = '';
    $h2_tag = '';
    }

    $before_r = '<div class="dbx-b-ox-wrapper"><fieldset id="testitdiv" class="dbx-box"><div class="dbx-h-andle-wrapper"><h3 class="dbx-handle">';
    $before_l = '</h3></div><div class="dbx-c-ontent-wrapper"><div class="dbx-content tt" style="padding-bottom: 0px;">';
    $after = '</div></div></fieldset></div>';
    if ( !function_exists( 'add_meta_box' ) ) {
    echo $before_r;
    _e("H1-H2 contents");
    echo $before_l;
    }
    ?>


    <table width="100%" border="0" id="h1h2">
    <tr>
    <td colspan="2">
    <p style="color: #777777;"> <b>To present these H1 and H2 in your post, you need to write this code :</b></p>
    <p style="color: #777777;"><b> &lt;?php&nbsp;do_action('wp_insert_h1h2tags');&nbs p;?&gt;</b></p>
    <p style="color: #777777;"><strong>into your file</strong></p>
    <p style="color: #777777;"><br />
    <b>/wp-content/themes/<i>NAMA_TEMA_ANDA</i>/header.php</b> which is put after the &lt;body&gt; tag . </p></td>
    </tr>
    <tr>
    <td colspan="2">
    <fieldset>
    <input type="checkbox" name="use_h1h2tags" checked="checked" value="1" <?=$already_used?'checked':'';?> />
    Use H1 & H2
    </fieldset>
    </td>
    </tr>
    <tr>
    <td>
    <fieldset>
    <legend>Content of H1</legend>
    <div><input type="text" name="h1_content" id="h1_content" value="<?=$already_used?$h1_tag:'Keyword 1';?>"></div>
    </fieldset>
    </td>
    <td>
    <fieldset>
    <legend>Content of H2</legend>
    <div><input type="text" name="h2_content" id="h2_content" value="<?=$already_used?$h2_tag:'Keyword 2';?>"></div>
    </fieldset>
    </td>
    </tr></table>



    <?php
    if ( !function_exists( 'add_meta_box' ) ) {
    echo $after;
    }
    }

    function tags_save($post_ID) {
    global $wpdb;

    $h1_content = (!empty($_POST['h1_content']))?$_POST['h1_content']:"Keyword 1";
    $h2_content = (!empty($_POST['h2_content']))?$_POST['h2_content']:"Keyword 2";

    $use_h1h2tags = isset($_POST['use_h1h2tags'])?$_POST['use_h1h2tags']:0;

    if ($use_h1h2tags == 1) {
    $h1h2_tags = '<h1 style="display: none;">'.$h1_content.'</h1><h2 style="display: none;">'.$h2_content.'</h2>';

    if (!add_post_meta($post_ID, 'vlnt_h1h2_tags', $h1h2_tags, true)){
    update_post_meta($post_ID, 'vlnt_h1h2_tags', $h1h2_tags);
    }
    }

    return $post_ID;
    }

    function tags_insert() {
    global $wpdb;
    global $post;

    if(is_page() || is_single() ) {
    $post_ID = $post->ID;
    }

    if (isset($post_ID)) {
    $h1h2_tags = get_post_meta($post_ID,'vlnt_h1h2_tags',true);
    echo $h1h2_tags;
    }
    }

    }

    $h1h2 = new h1h2_tags(0);


    add_action('activate_h1h2/h1h2.php', array(&$h1h2, 'install'));
    add_action('deactivate_h1h2/h1h2.php', array(&$h1h2, 'uninstall'));
    add_action('admin_menu', array(&$h1h2, 'onAdminMenuH1H2'));

    add_action('save_post', array(&$h1h2, 'tags_save'));
    add_action('wp_insert_h1h2tags', array(&$h1h2, 'tags_insert'));

    }

    ?>

    Signature

    {{ DiscussionBoard.errors[1053369].message }}
    • Profile picture of the author dadeon
      You don't need a plugin.

      Just expand your text editor in Wordpress and you will see that there is a drop down that allows your to assign H2, H3 or whatever to anything in the post.

      The post title will automatically get the H1 tag. To manipulate it you can just use the SEO Plugin which will create 3 new fields under each post.

      The first field is for the H1 tag, the 2nd field is for the description and the 3rd is for keywords. That's pretty much all you need for on-page SEO. Just search the Wordpress Plugins site for the SEO plugin - it's probably at the top of the list as the no. plugin.
      Signature
      PR3 in 7 Weeks - Get Front Page Google Rankings Fast

      Free Link Building Blueprint show you how...
      http://linkbuildingblueprint.com/download/
      {{ DiscussionBoard.errors[1054183].message }}
  • {{ DiscussionBoard.errors[2390054].message }}
  • Profile picture of the author thehobbster
    I'm pretty sure that hiding and using the h1 and h2 tags would be considered a no-no in search engines eyes. It's akin to keyword and meta-tag stuffing. It could do the reverse of what you hope in the serps, according to what I've read (I'm not actually interested in testing this theory!)

    Anyways, best of luck to you and your endeavours! Please be careful.
    {{ DiscussionBoard.errors[2391853].message }}

Trending Topics