Viewing 12 replies - 1 through 12 (of 12 total)
  • That should be somewhere in your stylesheet. You would need to locate the section related to your sidebar and edit the stylesheet to display it the way you want.
    eg. My sidebar looks something like this:
    /*—:[ sidebar styles ]:—*/

    ul.sidebar_list { list-style: none; }

    h2 { font-weight: bold; font-size: 1.077em; letter-spacing: normal; margin: 0 0 0.8em 0; padding: 0.4em 2px; border-top: 3px solid #000; background: url(”) 0 100% repeat-x; }

    You can see from this what is set for the h2 and you can change the font, background image, size, etc.

    Thread Starter vad111

    (@vad111)

    Hi there again,
    this is my sidebar:

    /* Sidebar */
    #sidebar {
    float: left;
    width: 200px;
    font-size:0.9em;
    }
    #sidebar ul
    {
    list-style:none;
    margin:0;
    padding:0;
    }
    #sidebar li
    {
    margin-bottom:8px;
    }
    #sidebar ul ul
    {
    list-style:none;
    margin:0.5em 0 0 1em;
    }
    #sidebar ul ul ul
    {
    margin:0 0 0 1em;
    }
    #sidebar li.sidebox {
    padding:1px 10px;
    margin:1 0 1em 0;
    background: url(img/sideheadtop.gif) #ededed no-repeat left top;
    }
    li#sidelinks ul
    {
    margin:0;
    padding:0;
    }
    #sidebar li.sidebox p img {
    margin:0;
    padding:3px;
    border:#ccc 1px solid;
    background:none;
    }

    I don’t see here any h2 or h3 fonts.
    I just want all my titles in sidebar to be h3 or h4.
    What should I insert here and where?

    Thanks a lot!!!
    Vad

    don’t change the actual tags, that’s bad mojo for wordpress functions.

    instead add a new definition in your stylesheet which makes H2 tags look like H4 tags.

    #sidebar h2 {
    your-property: goes #here;
    }

    will only change the H2 tags which reside in the sidebar… make them look like pickled pineapples if you want… just don’t go changing the tag names in your template.

    google yourself a new bookmark to a CSS reference. w3schools isn’t a bad place to start.

    Thread Starter vad111

    (@vad111)

    Ok, but I’d like Google search engine to see actual h3 h4 tags in the side bar titles. I think h2 tags are not suppose to be in the side bar! Side bar titles should be minimum h3 – h4. This is the correct SEO!
    How can I change them?
    Thanks,
    Vad

    You can not. Whatever you do, WP will spit out h2 for the links section title.
    Who says you cannot have h2 in the sidebar?
    (I assume you meant maximum…)

    As a workaround you can use template tags that don’t display link cat titles and re-write your theme’s sidebar to not have any h2… and then re-write your stylesheet for your newly added h3, h4. However, if you use widgets – the widgets always overwrite whatever you have in the sidebar, and will end up again with h2s.

    Thread Starter vad111

    (@vad111)

    I read in some SEO article where he explains negative SEO in WP.
    Yes I use widgets,
    So actually in order to change h2 to h3 I need to change something in widgets PHP? If yes, in what folder? where?
    Thanks

    Nowadays every gas station guy and his dog is a seo expert… Gimme a break ?? I write for people not for machines, so I don’t change core files ever, which means I am the wrong person to ask.

    That SEO advice is bullshit. Google doesn’t know what a sidebar is, and so has no idea what tags seem logical there.

    With bottom-bars, top-bars, side-bars and upside-down bars, there’s no way google SHOULD care about whether content is in a sidebar or not.

    Thread Starter vad111

    (@vad111)

    Ok, I read it here:
    https://www.johnchow.com/how-to-seo-your-wordpress-theme/
    I read it in other places as well.
    Please let me know what you think
    Vad

    Hallo everyone, I found a solution for the problem (which I think is important for search engine optimization.

    Just overwrite the text in the functions.php of your theme with the following:

    <?php
    if ( function_exists('register_sidebar') )
    register_sidebar(array('name'=>'sidebar1',
    'before_title' => '<h5>', // Replaces <h2>
    'after_title' => '</h5>', // Replaces </h2>
    ));
    register_sidebar(array('name'=>'sidebar2',
    'before_title' => '<h5>', // Replaces <h2>
    'after_title' => '</h5>', // Replaces </h2>
    ));
    ?>

    This will register up to 2 sidebars to your blog, where the h2-tags are replaced by h5-tags (you can change h5 to h4 or whatever you want of course).

    Please note: Depending on the theme you are using, there may be other functions that you want to keep. In that case do not just replace your original functions.php but insert the code needed in a proper way. ??

    @ivovic
    Google doesn’t know what a sidebar is, but it does know what a high level heading is and putting the word “Categories” in a level 2 heading is not good SEO.

    @vad111
    Changing the theme’s functions.php like gonzor said is the right way to fix this. However, if someone isn’t using widgets and they have the problem that moshu mentioned where the bookmark titles are still giving you h2’s, then simply edit your sidebar.php where it gives the code for the bookmarks like this:

    <?php wp_list_bookmarks('title_before=<h4>&title_after=</h4>'); ?>

    I encountered the same problem and edited wp-includes/widgets.php line 141 from
    $defaults = array(
    ‘name’ => sprintf(__(‘Sidebar %d’), $i ),
    ‘id’ => “sidebar-$i”,
    ‘before_widget’ => ‘<li id=”%1$s” class=”widget %2$s”>’,
    ‘after_widget’ => “\n”,
    ‘before_title’ => ‘<h2>’,
    ‘after_title’ => “</h2>\n”,
    );

    to

    $defaults = array(
    ‘name’ => sprintf(__(‘Sidebar %d’), $i ),
    ‘id’ => “sidebar-$i”,
    ‘before_widget’ => ‘<li id=”%1$s” class=”widget %2$s”>’,
    ‘after_widget’ => “\n”,
    ‘before_title’ => ‘<h4>’,
    ‘after_title’ => “</h4>\n”,
    );

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘chenging titles font from h2 to h4 only in the sidebar’ is closed to new replies.