• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

Widget Title – How to Change Default H Tags?

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › General Discussion › Widget Title – How to Change Default H Tags?

This topic is: not resolved

Tagged: Outreach Pro, seo, Widget H tags

  • This topic has 12 replies, 5 voices, and was last updated 8 years, 7 months ago by ducdan.
Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • December 20, 2013 at 12:57 pm #80486
    sdbroker
    Member

    Does anyone know the reason why ALL the default widget titles on Genesis themes are marked with an H4 tags? Better yet, how can I change those from the default H4 to let's say H2?

    For SEO purposes it doesn't make sense to have pages or posts with H2 headings inside an H4 title tag.

    Thank you!

    December 20, 2013 at 1:08 pm #80487
    Genesis Developer
    Member

    Try this code in functions.php file of your child theme

    remove_action( 'genesis_sidebar', 'genesis_do_sidebar' );
    add_action( 'genesis_sidebar', 'genesis_do_custom_sidebar' );
    
    function genesis_do_custom_sidebar() {
    
    	if ( ! dynamic_sidebar( 'sidebar' ) && current_user_can( 'edit_theme_options' )  ) {
    		genesis_custom_widget_area_content( __( 'Primary Sidebar Widget Area', 'genesis' ) );
    	}
    
    }
    
    function genesis_custom_widget_area_content( $name ) {
    
    	echo genesis_html5() ? '<section class="widget widget_text">' : '<div class="widget widget_text">';
    	echo '<div class="widget-wrap">';
    	
    		printf( '<h2 class="widgettitle">%s</h2>', esc_html( $name ) );
    		echo '<div class="textwidget"><p>';
    		
    			printf( __( 'This is the %s. You can add content to this area by visiting your <a href="%s">Widgets Panel</a> and adding new widgets to this area.', 'genesis' ), $name, admin_url( 'widgets.php' ) );
    		
    		echo '</p></div>';
    	
    	echo '</div>';
    	echo genesis_html5() ? '</section>' : '</div>';
    
    }

    Download Genesis Featured Posts Combo Widget | Simple Grid Layouts Plugin for Posts, CPTs and terms
    You can request new tips/help.

    December 20, 2013 at 1:50 pm #80494
    sdbroker
    Member

    Thanks for the quick reply @genwrock! Tried the code above but it didn't work. Titles still show with H4 tag headings.

    Take a look at this example on the Agency Pro demo http://demo.studiopress.com/agency/

    The headings "Our Work" & "Recent Articles" that are the featured posts widget titles are marked with H4 tags. Inside those H4 tags are the articles with H2 headings. I'm under the impression that enclosing higher H tags within lower H tags is a big NO for SEO.

    The same is true not only on the Agency Pro theme but on ALL the G child themes that I looked at.

    December 20, 2013 at 7:01 pm #80543
    emasai
    Participant

    There must be rhyme to their reason and I would think that the page structures the h tags hierarchically according to their relevance to the home page. Once you get to the actual post the hierarchy changes. Maybe this article will help http://www.hobo-web.co.uk/headers/


    Need Website Customization or a Responsive CSS fix? Contact Me
    Lynne emasai.com

    December 20, 2013 at 10:53 pm #80565
    Genesis Developer
    Member

    Ok. Please remove my code from functions.php. It was for primary sidebar.

    some how you can send me the code of functions.php file? I'll take a look.


    Download Genesis Featured Posts Combo Widget | Simple Grid Layouts Plugin for Posts, CPTs and terms
    You can request new tips/help.

    December 21, 2013 at 2:50 am #80577
    sdbroker
    Member

    @emasai Thanks for the link, I don't know if you noticed but the video that he talks about the H tag syntax errors is almost 5 years old.. so it's totally irrelevant today that Google even pays attention to spelling. An H2 tag should never be inside an H4.
    Not sure if that's an oversight from Genesis but it's bad for SEO.


    @genwrock
    The h4 tag is by default on ALL Genesis child themes, that's why I point you to the demo link above. Look at the functions.php on any of the child themes that you have, also look at the front-page.php on any child theme that uses widgets to input content on the front page. It's not specific to a custom theme.

    The quick and dirty fix that I use until this is solved, I hardcode H1 or H2 tags in front-page.php right before the genesis_widget_area and I never input a title on a featured page, post or portfolio widget.

    Hopefully someone here knows a code that can fix this or StudioPress will address it as I think that it's a major flow.

    December 21, 2013 at 3:24 am #80578
    Genesis Developer
    Member

    Right now I have not agency pro theme. For that reason I asking the code. But you can pass this 'before_title' => '<h2 class="widget-title">' and 'after_title' => '</h2>' in genesis_register_sidebar() function


    Download Genesis Featured Posts Combo Widget | Simple Grid Layouts Plugin for Posts, CPTs and terms
    You can request new tips/help.

    December 21, 2013 at 4:49 pm #80668
    sdbroker
    Member

    @genwrock Ok, I see! I tried that last code in both functions.php & front-page.php with no results.

    Below is the corresponding functions.php & front-page.php code for the newest theme Modern Portfolio (http://demo.studiopress.com/modern-portfolio/) which also has the same issue (includes h2 headings INSIDE the h4 main title that comes from the widget) .

    Corresponding Portfolio widget code in functions.php file:

    //* Register widget areas
    genesis_register_sidebar( array(
    	'id'          => 'home-portfolio',
    	'name'        => __( 'Home - Portfolio','mpp' ),
    	'description' => __( 'This is the portfolio section of the homepage.','mpp' ),
    ) );

    Corresponding Portfolio widget code in front-page.php file:

    /**
     * Add widget support for homepage. If no widgets active, display the default loop.
     *
     */
    function mpp_home_genesis_meta() {
    
    	if ( is_active_sidebar( 'home-portfolio' ) ) {
    
    		// Force content-sidebar layout setting
    		add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_full_width_content' );
    
    		// Add mpp-home body class
    		add_filter( 'body_class', 'mpp_body_class' );
    
    		// Remove the navigation menus
    		remove_action( 'genesis_after_header', 'genesis_do_nav' );
    		remove_action( 'genesis_after_header', 'genesis_do_subnav' );
    
    		// Remove the default Genesis loop
    		remove_action( 'genesis_loop', 'genesis_do_loop' );
    
    		// Add homepage widgets
    		add_action( 'genesis_loop', 'mpp_homepage_widgets' );
    
    	}
    
    }
    
    function mpp_body_class( $classes ) {
    
    	$classes[] = 'mpp-home';
    	return $classes;
    	
    }
    
    function mpp_homepage_widgets() {
    
    	genesis_widget_area( 'home-portfolio', array(
    		'before' => '<div id="portfolio"><div class="wrap">',
    		'after'  => '</div></div>',
    	) );
    
    }

    Something similar is on the Agency them but instead of Portfolio uses the "Featured Posts" widget and also on every other theme that uses widgets to input content on the front page either using the "Featured Posts", "Portfolio" or text widgets. When you input the widget title, it is marked up with an H4 tag that should be either an H1 (for HTML5 themes or H2 for everything else).

    December 21, 2013 at 10:51 pm #80698
    Genesis Developer
    Member

    Then you can replace the following code

    //* Register widget areas
    genesis_register_sidebar( array(
    	'id'          => 'home-portfolio',
    	'name'        => __( 'Home - Portfolio','mpp' ),
    	'description' => __( 'This is the portfolio section of the homepage.','mpp' ),
    ) );

    WITH THIS WAY

    //* Register widget areas
    register_sidebar( array(
    	'id'          => 'home-portfolio',
    	'name'        => __( 'Home - Portfolio','mpp' ),
    	'description' => __( 'This is the portfolio section of the homepage.','mpp' ),
           'before_widget' => '<section id="%1$s" class="widget %2$s"><div class="widget-wrap">',
    	'after_widget'  => '</div></section>',
           'before_title' => '<h2 class="widget-title">',
           'after_title' => '</h2>'
    ) );

    Download Genesis Featured Posts Combo Widget | Simple Grid Layouts Plugin for Posts, CPTs and terms
    You can request new tips/help.

    December 22, 2013 at 3:06 pm #80801
    sdbroker
    Member

    This worked like a charm even on text widgets. Thank you soooo much for all your help!

    Since this was fixed for my purposes, I should marked it as resolved... but I won't with the hope that StudioPress will address this issue on its release of the Genesis framework which is where it should be addressed.

    December 22, 2013 at 10:09 pm #80849
    Genesis Developer
    Member

    You are Welcome.


    Download Genesis Featured Posts Combo Widget | Simple Grid Layouts Plugin for Posts, CPTs and terms
    You can request new tips/help.

    February 14, 2014 at 3:42 am #90251
    samw
    Member

    Hi

    I also need to do this for all Outreach Pro widget titles as they are wrapped in H4 tags. I tried adding this

    'before_widget' => '<section id="%1$s" class="widget %2$s"><div class="widget-wrap">',
    'after_widget' => '</div></section>',
    'before_title' => '<h2 class="widget-title">',
    'after_title' => '</h2>'

    But it's not working - think the number and order of widgets is more complex for the theme
    It uses footers, featured pages, sub footers and sidebars

    From Outreach Pro Home Page.PHP

    add_action( 'genesis_meta', 'outreach_home_genesis_meta' );
    /**
    * Add widget support for homepage. If no widgets active, display the default loop.
    *
    */
    function outreach_home_genesis_meta() {

    if ( is_active_sidebar( 'home-top' ) || is_active_sidebar( 'home-bottom' ) ) {

    //* Force full-width-content layout setting
    add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_full_width_content' );

    //* Add outreach-pro-home body class
    add_filter( 'body_class', 'outreach_body_class' );

    //* Remove breadcrumbs
    remove_action( 'genesis_before_loop', 'genesis_do_breadcrumbs' );

    //* Remove the default Genesis loop
    remove_action( 'genesis_loop', 'genesis_do_loop' );

    //* Add home top widgets
    add_action( 'genesis_loop', 'outreach_home_top_widgets' );

    //* Add home bottom widgets
    add_action( 'genesis_before_footer', 'outreach_home_bottom_widgets', 1 );

    }

    }

    function outreach_body_class( $classes ) {

    $classes[] = 'outreach-pro-home';
    return $classes;

    }

    function outreach_home_top_widgets() {

    genesis_widget_area( 'home-top', array(
    'before' => '<div class="home-top widget-area">',
    'after' => '</div>',
    ) );

    }

    function outreach_home_bottom_widgets() {

    genesis_widget_area( 'home-bottom', array(
    'before' => '<div class="home-bottom widget-area"><div class="wrap">',
    'after' => '</div></div>',
    ) );

    }

    genesis();

    From functions.php
    //* Hook after post widget after the entry content
    add_action( 'genesis_after_entry', 'outreach_after_entry', 5 );
    function outreach_after_entry() {

    if ( is_singular( 'post' ) )
    genesis_widget_area( 'after-entry', array(
    'before' => '<div class="after-entry widget-area">',
    'after' => '</div>',
    ) );

    }

    //* Modify the size of the Gravatar in the author box
    add_filter( 'genesis_author_box_gravatar_size', 'outreach_author_box_gravatar_size' );
    function outreach_author_box_gravatar_size( $size ) {

    return '80';

    }

    //* Remove comment form allowed tags
    add_filter( 'comment_form_defaults', 'outreach_remove_comment_form_allowed_tags' );
    function outreach_remove_comment_form_allowed_tags( $defaults ) {

    $defaults['comment_notes_after'] = '';
    return $defaults;

    }

    //* Add the sub footer section
    add_action( 'genesis_before_footer', 'outreach_sub_footer', 5 );
    function outreach_sub_footer() {

    if ( is_active_sidebar( 'sub-footer-left' ) || is_active_sidebar( 'sub-footer-right' ) ) {
    echo '<div class="sub-footer"><div class="wrap">';

    genesis_widget_area( 'sub-footer-left', array(
    'before' => '<div class="sub-footer-left">',
    'after' => '</div>',
    ) );

    genesis_widget_area( 'sub-footer-right', array(
    'before' => '<div class="sub-footer-right">',
    'after' => '</div>',
    ) );

    echo '</div><!-- end .wrap --></div><!-- end .sub-footer -->';
    }

    }

    //* Register widget areas
    genesis_register_sidebar( array(
    'id' => 'home-top',
    'name' => __( 'Home - Top', 'outreach' ),
    'description' => __( 'This is the top section of the Home page.', 'outreach' ),
    ) );
    genesis_register_sidebar( array(
    'id' => 'home-bottom',
    'name' => __( 'Home - Bottom', 'outreach' ),
    'description' => __( 'This is the bottom section of the Home page.', 'outreach' ),
    ) );
    genesis_register_sidebar( array(
    'id' => 'after-entry',
    'name' => __( 'After Entry', 'outreach' ),
    'description' => __( 'This is the after entry widget area.', 'outreach' ),
    ) );
    genesis_register_sidebar( array(
    'id' => 'sub-footer-left',
    'name' => __( 'Sub Footer - Left', 'outreach' ),
    'description' => __( 'This is the left section of the sub footer.', 'outreach' ),
    ) );
    genesis_register_sidebar( array(
    'id' => 'sub-footer-right',
    'name' => __( 'Sub Footer - Right', 'outreach' ),
    'description' => __( 'This is the right section of the sub footer.', 'outreach' ),
    ) );

    If anyone can suggest the code to change all the widget titles to H2 would be much appreciated

    Thanks in Advance


    SEO & Online Marketing Consultant

    Metta3 | G+ | LinkedIn

    December 5, 2016 at 11:59 pm #197105
    ducdan
    Member

    Biệt thự Vinhomes quận 9

  • Author
    Posts
Viewing 13 posts - 1 through 13 (of 13 total)
  • The forum ‘General Discussion’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2025 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble