Created
March 1, 2017 23:34
-
-
Save sirchrispy/230d661ebb4f0e31ff167a95c77454af to your computer and use it in GitHub Desktop.
WordPress MultiSite and Genesis: Change Site Descriptions to Main Site Description
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Change header description for sub-sites to main site's description | |
add_filter( 'genesis_seo_description', 'tcd_change_header_description', 10, 3); | |
function tcd_change_header_description( $description, $inside, $wrap ) { | |
if ( is_main_site() ) { | |
$inside = esc_html( get_bloginfo( 'description' ) ); | |
} else { | |
switch_to_blog(1); | |
$inside = esc_html( get_bloginfo( 'description' ) ); | |
restore_current_blog(); | |
} | |
return sprintf( "<{$wrap} %s>%s</{$wrap}>", genesis_attr( 'site-description' ), $inside ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment