Created
March 1, 2017 23:31
-
-
Save sirchrispy/8256fdfa050d98556bf7a24cc1f452a1 to your computer and use it in GitHub Desktop.
WordPress MultiSite and Genesis: Change Title Area URLs to main Site URL
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 URL for sub-sites to main site's URL | |
add_filter( 'genesis_seo_title', 'tcd_change_header_url', 10, 3 ); | |
function tcd_change_header_url( $title, $inside, $wrap ) { | |
if ( is_main_site() ) { | |
$network_name = get_bloginfo( 'name' ); | |
$network_url = get_bloginfo( 'url' ); | |
} else { | |
switch_to_blog(1); | |
$network_name = get_bloginfo( 'name' ); | |
$network_url = get_bloginfo( 'url' ); | |
restore_current_blog(); | |
} | |
$new_url = "<a href='$network_url' title='%s'>%s</a>"; | |
$inside = sprintf( $new_url, esc_attr( $network_name ), $network_name ); | |
return sprintf( "<{$wrap} %s>%s</{$wrap}>", genesis_attr( 'site-title' ), $inside ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment