Skip to content

Instantly share code, notes, and snippets.

@shazdeh
Last active December 27, 2015 07:49
Show Gist options
  • Save shazdeh/7291827 to your computer and use it in GitHub Desktop.
Save shazdeh/7291827 to your computer and use it in GitHub Desktop.
Customizing the site titles per-page using a custom field
<?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