Help with widget headings

Hi all,

I’m new to wordpress and work in SEO where I am also fairly new, so I’m still getting used to the ropes. I have a issue which I can’t seem to find a solution too and the wordpress support forums seem pretty poor. So hopefully someone can help me out, I’m also likely to come back for more advice in the future if this is the case :smiley:

I have several widgets active on the right side of my website, and they are appearing as h2 something I don’t want them to be, hes a picture showing what I mean. As I am aware having too many headings can be bad for SEO.

http://postimage.org/image/cqu5amfxx/
My website is, www.home24.co.uk

I hope this is not breaking any rules I’m just really struggerling with finding some basic help for a poor intern, if I am indeed breaking the rules I apologise in advance!

Welcome to the SP forums.

I googled a bit and found this: http://wordpress.org/support/topic/change-widget-title-h2-wrapper-to-span
It is 4 years old, so some things might have changed in the current WP version, but it’s a start :wink:

So I still can’t get i to work, I can’t find the widget coding in the editor anywhere.
Any ideas?

Here is an example of the code for one of the headings on the right hand side, this was seen using a chrome extension.

<li id="text-4" class="widget widget_text">
<h2 class="widgettitle">Everything you need to know about online shopping</h2>

What editor?

Wordpress Appearance editor? I’m sure its an easy fix I’m just quite poor when it comes to this. :frowning:

Open the editor.
In the list of template files on the right choose Theme Functions (functions.php).
Inside the code, do a search for register_sidebar, and change the code in the lines


'before_title' => '<h4 class="widget-title">',
'after_title' => '</h4>',

Then update the file.
Done.

I had h3 there, and changed it to h4. It works perfectly fine.

Edit: you will loose the change if you ever update the theme you’re using, unless you created a child theme and made the change there.
Start here if you want to know more about child themes: http://codex.wordpress.org/Child_Themes

Hi, so I only have this in my theme funtions template file, strange?

<?php
if ( function_exists('register_sidebars') )
    register_sidebars(3);
?>

Ok, change that in


<?php
if ( function_exists('register_sidebars') )
    register_sidebars(3, array('before_title'=>'<h4>','after_title'=>'</h4>'));
?>

Change h4 in whatever you want it to be.

Of course, you might have to add something to your css file to style the new widget titles.

Edit: take a look at the manual: http://codex.wordpress.org/Function_Reference/register_sidebars

Thanks guido! It worked :slight_smile:

I’m sure you will be seeing more of me on here as time goes by, hopefully i’ll be an expert one day…