Site logo

Archived topic

Change code for widget titles

9 replies · Started by morriscountynj on April 11, 2017

Viewing posts 1–10 of 10

Right now, widgets default to <h4> tags.

For accessibility reasons (headers should really only be used for actual headers of a section of content, and in that case need to be nested properly; widget titles aren't in the page flow) I'd like to change that to <p> tags. How would I go about doing that?

perfect, thank you :)

You're welcome :)

All widgets in GP use the same filter.

this code is correct ?

add_filter( 'generate_start_widget_title','generate_remove_widget_title_h4' );
function generate_remove_widget_title_h4()
{
      return '<span class="widget-title-side">';
}

add_filter( 'generate_end_widget_title','generate_remove_widget_title_end_h4' );
function generate_remove_widget_title_end_h4()
{
      return '</span>';
}

Yep, looks good to me.

Hello Tom

Sorry if I reopen a old topic, but is for the same think I want to change the title widget to h4 my SEO consultant recommended that to me.

Is this code correct?

add_filter( 'generate_start_widget_title','h2_to_h4' );
function h2_to_h4()
{
return '<h4 class="widget-title" /h4>';
}

and I put it on a functions.php is that OK?

Thanks

This archived topic is closed to new replies.