1

I need to change my site tag line. Basically, this is school site we create for xyz higher sec school and ABC Nursery school; so I need to add both as a tag line in my site if I use xyz higher sec school I can't be able to use ABC NURSERY for those particular pages.

I need to change tagline for around only 6 pages; kindly suggest me for that.

  • 1
    If I'm understanding correctly it sounds like you will need to create a child theme, and instead of outputting the site tagline for certain pages, you'll need a conditional to output the other wording you want to appear there. – WebElaine Jun 1 at 13:26
  • yes obviously correct – Arumugam G Jun 1 at 13:40
  • Welcome to WordPress Development. I hope you find the answer(s) you are looking for. Our site is different from most - if you have not done so yet, consider checking out the tour and help center to find out how things work. – Matthew Brown aka Lord Matt Jun 1 at 19:16
1

If your theme is using the WordPress site tagline, you should be able to filter it. get_bloginfo( 'description' ) will call get_option( 'blogdescription' );, and we can filter the value of an option using the option_{$option} hook.

Let's suppose, for this code sample, that you want to change the tagline on 3 pages, with the titles Kindergarten, Nursery School, and Babysitting.

add_filter( 'option_blogdescription', 'wpse368031_change_tagline' );
function wpse368031_change_tagline( $tagline ) {
    $pages = array( 'Kindergarten', 'Nursery School', 'Babysitting' );
    if ( is_page( $pages ) ) {
        $tagline = 'ABC Nursery';
    }
    return $tagline;
}

Try adding this code to your active theme's functions.php file.

Reference

| improve this answer | |
  • 1
    its working fine thanks a lot @Pat J – Arumugam G Jun 1 at 15:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.