Community Forums › Forums › Archived Forums › General Discussion › Trying to have a different tagline (site-description) on one page only
- This topic has 6 replies, 2 voices, and was last updated 6 years ago by Brad Dalton.
-
AuthorPosts
-
March 2, 2018 at 7:12 pm #217229strannikMember
I'm trying to set up a separate unique tagline for one page of my site. After scouring the interwebs, I saw two possible solutions to add to my child theme function.php, neither of which works for me.
add_filter( 'bloginfo', 'change_bloginfo_tagline', 10, 2 ); function change_bloginfo_tagline( $text, $show ) { if ('description' == $show && is_page( '88')) { $text = 'Monitoring, is our business'; } return $text; }
and this:
add_filter( 'bloginfo', 'change_bloginfo', 10, 2 ); function change_bloginfo( $text, $show ) { //print($text); if ('description' == $show) { if(is_page('88')){ $text = 'Monitoring, is our business'; }else{ $text = html_entity_decode($text); } } return $text; }
What am I doing wrong?
Is this a specific genesis issue?
Is there a better way to do this?TIA
https://monitusa.comMarch 2, 2018 at 7:24 pm #217231Brad DaltonParticipantUse the Genesis filter to modify the default output of the genesis_site_description function.
https://gist.github.com/braddalton/e9740b1f9fafcc260cc62c6d82b94096
March 2, 2018 at 7:41 pm #217234strannikMemberThanks for the quick response. That code is a bit opaque to me
Do I add this code to my function.php?
What do I modify so that one page of page-id-x gets the special tagline and the rest get the normal tagline?
March 2, 2018 at 7:50 pm #217235Brad DaltonParticipantThats the default function which you'll need to modify using the filter hook.
March 2, 2018 at 8:13 pm #217236Brad DaltonParticipantMarch 2, 2018 at 9:31 pm #217237strannikMemberI tried modifying one of the examples as follows:
add_filter( 'genesis_seo_description','conditional_site_description'); /** * @author Brad Dalton * @example http://wpsites.net/web-design/remove-genesis-site-description-conditionally/ * @copyright 2014 WP Sites */ function conditional_site_description($description) { if ( is_page('88') ) : $description = 'Monitoring, is our business'; return; else : return $description; endif; }
But it doesn't work - the page-id-88 just displays with no tagline.
What am I missing?
March 2, 2018 at 10:02 pm #217239Brad DaltonParticipantYes, that code i linked to removes the tagline conditionally.
What you need to do is modify the value for the $inside variable conditionally using the genesis_seo_description filter.
This requires some work on your behalf to write and test the code. Otherwise, please search for a tutorial which contains the code you need.
Happy to point you in the right direction.
Note : Filter functions require advanced PHP coding skills however you can look at existing code snippets which use the filter to get a idea on how it works.
-
AuthorPosts
- The forum ‘General Discussion’ is closed to new topics and replies.