• Resolved jbgglgdev

    (@jbgglgdev)


    Hi, how can I make the hero widget-title a H1 (now it’s a H2).
    I have done this to resize the font, but now I would like hero to become a H1 :

    .hero .widget .widget-title {
    font-size: 75px;
    }

    thank’s
    JB

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi @jbgglgdev,

    If you are just trying to change the hero widget title from an h2 to an h1, you can use the primer_sidebars filter built into the theme. This would allow you to set the before_title and the after_title parameters for the hero widget, subsequently altering the HTML elements wrapping the hero widget title.

    You will want to setup an MU plugin where you can add the below code to. We have written a help article explaining how to properly setup an MU plugin on your site here – https://github.com/godaddy/wp-primer-theme/wiki/Customizing-Primer-with-hooks#how-to-create-a-must-use-plugin.

    Once you have your MU plugin setup, you should be able to add the following code to the MU plugin, to set the hero widget elements to h1 instead of h2.

    /**
     * Alter the Primer hero widgets.
     *
     * @param  array $widgets Array of Primer widgets.
     *
     * @return array          Filtered array of Primer widgets.
     */
    function alter_primer_widgets( $widgets ) {
    
    	$widgets['hero']['before_title'] = '<h1 class="widget-title">';
    	$widgets['hero']['after_title']  = '</h1>';
    
    	return $widgets;
    
    }
    add_filter( 'primer_sidebars', 'alter_primer_widgets' );

    Once you’ve added the above code to the new MU plugin, you can save the file and reload the homepage. You should then find the hero widget title is wrapped in an h1 element instead of the default h2 element.

    Let us know how that works for you!

    Thread Starter jbgglgdev

    (@jbgglgdev)

    BRAVO ! Thank you, this is working perfectly ??
    really nice of you.
    JB

    Anytime! Thank you for posting back here with the outcome. Have a great rest of your day!

    Evan

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘hero widget-title H1’ is closed to new replies.