No results found. Try again with different words?

Search must be at least 3 characters.

How to Change HTML tag for Site Title and Tagline?

Sidebar Image

Did not find a solution? We are here to help you succeed.

A Site Title is the name of your website, and the tagline is a small catchy descriptive line for your site.

To access it, go to the Astra Customizer.

From here, navigate to Header Builder > Site Title & Logo, you can add a Title and a Tagline for your site.

By default, the Title has Heading 1 tag <H1> while the tagline has paragraph tag <p> in the HTML structure. You can change this tag to any other HTML tag using the following filters:

  • Change Tag For a Tagline. Paste this code in the child theme’s functions.php file.
add_filter( 'astra_site_tagline_tag', 'astra_change_site_tagline_tag' );

/* Function to change tag of Site Tagline.
@param string $tag Default is p tag.
*/
function astra_change_site_tagline_tag( $tag ) {
$tag = 'h6';
return $tag;
}

Note: The above filter will change from tag to tag. You can update it as per your requirements.

This is how your Default tag looks before adding the filter.

And this is the change from <p> to <H6> in your code after adding the Filter.

To confirm this, you can check the code using the Inspect element.

You can also replace the H1 tag for the Title with the span tag using the below filter.

  • Change Tag For a Site Title
add_filter( 'astra_site_title_tag', 'astra_function_change_site_title' );

/**
* Function to replace h1 tag with span in site title.
*
* @param string $tag This contains the tag used for site titles.
* @return string
*/
function astra_function_change_site_title( $tag ) {
    $tag = 'span';
    return $tag;
}

‘astra_show_title_h1_tag’ filter:

add_filter( 'astra_show_site_title_h1_tag', '__return_true' );

That’s it! We hope this guide helps you. If you have any more doubts, do reach out to us.

Was this article helpful?
Sidebar Image

Did not find a solution? We are here to help you succeed.

Related Docs

Join 1,653,898+ Happy Site Owners Using Astra

Whether you are a beginner, small business owner, or professional web developer, Astra provides all the tools you need to easily build your beautiful WordPress website.

REWIND

YEAR IN REVIEW

Download is Just A Click Away!

Membership Retention Checklist Download

Download is Just A Click Away!

Enter your email address and be the first to learn about updates and new features.

Download Free Astra Theme - Modal Popup Form
Scroll to Top
Now choose your preferred
page builder addon
Choose your preferred page builder addon

Download is Just A Click Away!

Enter your email address and be the first to learn about updates and new features.

Download Free Astra Theme - Modal Popup Form