Site icon sleon productions

How to Change the Site Title on a Specific Page in WordPress Using Astra Theme

If you’re using the popular Astra theme in WordPress and want to display a different site title on a specific page—such as customizing the header for an “About” or “Landing” page—you can easily achieve this by adding a few lines of code to your theme’s functions.php file.

Why Customize the Site Title?

Tailoring the site title for specific pages can help:


Step-by-Step: Change Astra’s Site Title on One Page

  1. Open your WordPress dashboard
  2. Go to Appearance > Theme File Editor
  3. Locate and open the functions.php file in your child theme (always recommended to use a child theme)
  4. Add the following code:
function custom_astra_site_title_change( $title ) {
if ( is_page( 'about' ) ) { // Replace 'about' with your page slug or ID
$title = 'Custom Title for About Page';
}
return $title;
}
add_filter( 'astra_site_title', 'custom_astra_site_title_change' );

Optional: Change the Tagline Too

To customize the site tagline (the subtitle below the site title), you can use:

function custom_astra_site_tagline_change( $tagline ) {
if ( is_page( 'about' ) ) {
$tagline = 'Your custom tagline here';
}
return $tagline;
}
add_filter( 'astra_site_tagline', 'custom_astra_site_tagline_change' );

What If You Want to Change the Browser Tab Title Too?

The browser title is controlled separately. You can override it with:

function custom_document_title_parts( $title ) {
if ( is_page( 'about' ) ) {
$title['title'] = 'Custom Browser Tab Title';
}
return $title;
}
add_filter( 'document_title_parts', 'custom_document_title_parts' );

Final Notes

By using WordPress filters, you can smartly adjust your site’s appearance based on context—without breaking theme updates or overriding complex templates.

Exit mobile version