Customizing the site titles per-page using a custom field
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 | |
function custom_site_title( $html, $location, $logo_tag, $type ) { | |
global $post; | |
if( is_singular() && $custom_title = get_post_meta( $post->ID, 'site_title', true ) ) { | |
$title = get_bloginfo('name'); | |
$html = str_replace( $title, $custom_title, $html ); | |
} | |
return $html; | |
} | |
add_filter( 'themify_site_logo_logo_html', 'custom_site_title', 10, 4 ); | |
/* custom site-description text per-page */ | |
function custom_before_layout( $value ) { | |
if( is_singular() && $slogan = get_post_meta( $post->ID, 'Slogan', true ) ) { | |
$value = $slogan; | |
} | |
return $value; | |
} | |
if( ! is_admin() ) | |
add_action( 'option_blogdescription', 'custom_before_layout' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment