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!