exist Astra In the theme.Site Titleindicates the name of the site.subheadingare short and attractive descriptive phrases. By default, Astra uses the following for site titles H1 tags, and for subheadings, use the<p>Tags. If you need to change these labels, you can do so by customizing the filter.
![图片[1]-如何在 Astra 主题中更改网站标题和副标题的 HTML 标签](https://www.361sale.com/wp-content/uploads/2025/04/20250422104922950-image.png)
Site title and tagline setup
nodecaptionis the name of the site.placardsis a short and compelling descriptive phrase.
To access and modify them, use the Astra CustomizerThe
![图片[2]-如何在 Astra 主题中更改网站标题和副标题的 HTML 标签](https://www.361sale.com/wp-content/uploads/2025/04/20250422105253527-image.png)
Astra Customizer
- show (a ticket) Astra CustomizerThe
- Navigate to Header Builder > Site Title & LogoYou can add a title and tagline to your website.
![图片[3]-如何在 Astra 主题中更改网站标题和副标题的 HTML 标签](https://www.361sale.com/wp-content/uploads/2025/04/20250422105305655-image.png)
Change the HTML tag for the subtitle
By default, site titles use the H1 tags, while the tagline uses <p> Tags. If you need to change these labels, you can change them to something else by using the following filter HTML Tags.
To change subheading HTML tag, you can add the following code to thesubtheme(used form a nominal expression) functions.php Documentation:
add_filter( 'astra_site_tagline_tag', 'astra_change_site_tagline_tag' );
/* A function to change the subtitle tag.
@param string $tag Default is the p tag. */
function astra_change_site_tagline_tag( $tag ) {
$tag = 'h6'; // Change to whatever tag is desired (e.g. h2, h3, etc.).
return $tag;
}
This filter will change the default label of the subtitle to (or any selected label).
This is what the default label looked like before the filter was added.
![图片[4]-如何在 Astra 主题中更改网站标题和副标题的 HTML 标签](https://www.361sale.com/wp-content/uploads/2025/04/20250422105714200-image.png)
This is after adding the FilterCode from the <p> until (a time) <h6> The change.
![图片[5]-如何在 Astra 主题中更改网站标题和副标题的 HTML 标签](https://www.361sale.com/wp-content/uploads/2025/04/20250422105736680-image.png)
Use your browser's Check Elements The tool can confirm the changes.
![图片[6]-如何在 Astra 主题中更改网站标题和副标题的 HTML 标签](https://www.361sale.com/wp-content/uploads/2025/04/20250422105804522-image.png)
Changing the title of a website HTML tab (of a window) (computing)
connect Site Title (used form a nominal expression) H1 The tag is replaced with<span> tags, the following filters can be used:
add_filter( 'astra_site_title_tag', 'astra_function_change_site_title' );
/**
* A function that replaces the h1 tag of a site title with a span tag.
*
* @param string $tag This is the tag to use for the site title.
* @return string
*/
function astra_function_change_site_title( $tag ) {
$tag = 'span'; // Change to whatever tag is desired (e.g. h2, span, etc.).
return $tag;
}
Mandatory use of H1 tags
If required Force website titles to always use H1 tags, the following filters can be used:
add_filter( 'astra_show_site_title_h1_tag', '__return_true' );
summarize
With the above method, it is possible to flexibly change the nodecaption respond in singing subheading (used form a nominal expression) HTML Tags. This helps to adjust the use of tags according to the actual needs and achieve a more appropriate website structure effect.
Recent Updates
Link to this article:https://www.361sale.com/en/51196/The article is copyrighted and must be reproduced with attribution.


















![表情[wozuimei]-光子波动网 | WordPress教程、Elementor教程与故障修复](https://www.361sale.com/wp-content/themes/zibll/img/smilies/wozuimei.gif)
![表情[baoquan]-光子波动网 | WordPress教程、Elementor教程与故障修复](https://www.361sale.com/wp-content/themes/zibll/img/smilies/baoquan.gif)

No comments