Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #104390
    discoman
    Participant

    Dear team,

    In my online casino site, I wish to change all the widget titles from H2 to h4.

    In which file can I change sidbar and footer wiget titles from H2 to h4?

    Sidbar sample:

    <section id="image-3" class="widget widget_image">
       <div class="widget-wrap">
         <h2 class="widget-title">SIDEBAR WIDGET NAME</h2>
       ...
    

    Footer sample”

    <section id="text-2" class="widget widget_text">
       <div class="widget-wrap">
          <h2 class="widget-title">FOOTER WIDGET NAME</h2>
       ...
    

    Btw, I really respect Matt Cutts, but I prefer to demote these titles to h4.

    Thanks, Offir

    #104443
    Pratik
    Keymaster

    HI @discoman,

    For this, you need to make modifications via child theme. Please make a child theme first. The instructions are here: http://catchthemes.com/blog/create-child-theme-wordpress/

    After this, please let me know and I will provide you with functions.

    Regards,
    Pratik

    #104447
    discoman
    Participant

    Hi Patrik,
    Child theme created

    #104492
    Pratik
    Keymaster

    Ok not please try adding following function in your child theme’s functions.php file.

    
    /**
    * Function to update sidebars
    */
    function clean_magazine_child_update_sidebars() {
    	unregister_sidebar( 'primary-sidebar' );
    	unregister_sidebar( 'header-right' );
    	unregister_sidebar( 'footer-1' );
    	unregister_sidebar( 'footer-2' );
    	unregister_sidebar( 'footer-3' );
    
    	//Primary Sidebar
    	register_sidebar( array(
    		'name'          => __( 'Primary Sidebar', 'clean-magazine' ),
    		'id'            => 'primary-sidebar',
    		'before_widget' => '<section id="%1$s" class="widget %2$s"><div class="widget-wrap">',
    		'after_widget'  => '</div><!-- .widget-wrap --></section><!-- #widget-default-search -->',
    		'before_title'  => '<h4 class="widget-title">',
    		'after_title'   => '</h4>',
    		'description'	=> __( 'This is the primary sidebar if you are using a two column site layout option.', 'clean-magazine' ),
    	) );
    
    	//Header Right
    	register_sidebar( array(
    		'name'          => __( 'Header Right', 'clean-magazine' ),
    		'id'            => 'header-right',
    		'before_widget' => '<section id="%1$s" class="widget %2$s"><div class="widget-wrap">',
    		'after_widget'  => '</div><!-- .widget-wrap --></section><!-- #widget-default-search -->',
    		'before_title'  => '<h4 class="widget-title">',
    		'after_title'   => '</h4>',
    		'description'	=> __( 'This is the header right widget area. It typically appears on the right of the site title or logo. This widget area is not equipped to display any widget, and works best with a search form, social icons widget, Advertisement Widget or possibly a text widget.', 'clean-magazine' ),
    	) );
    
    	for( $i=1; $i <= 3; $i++ ) {
    		register_sidebar( array(
    			'name'          => sprintf( __( 'Footer Area %d', 'clean-magazine' ), $i ),
    			'id'            => sprintf( 'footer-%d', $i ),
    			'before_widget' => '<section id="%1$s" class="widget %2$s"><div class="widget-wrap">',
    			'after_widget'  => '</div><!-- .widget-wrap --></section><!-- #widget-default-search -->',
    			'before_title'  => '<h4 class="widget-title">',
    			'after_title'   => '</h4>',
    			'description'	=> sprintf( __( 'Footer %d widget area.', 'clean-magazine' ), $i ),
    		) );
    	}
    
    }
    add_action( 'widgets_init', 'clean_magazine_child_update_sidebars', 11 );
    
    #104506
    discoman
    Participant

    Hi,

    Working. thank you very much.

    Offir

Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘Change widget titles from H2 to h4’ is closed to new replies.