tag based on what is being viewed.
*
* @param string $title Default title text for current view.
* @param string $sep Optional separator.
* @return string The filtered title.
*/
function phosphor_wp_title( $title, $sep ) {
if ( is_feed() ) {
return $title;
}
global $page, $paged;
// Add the blog name
$title .= get_bloginfo( 'name', 'display' );
// Add the blog description for the home/front page.
$site_description = get_bloginfo( 'description', 'display' );
if ( $site_description && ( is_home() || is_front_page() ) ) {
$title .= " $sep $site_description";
}
// Add a page number if necessary:
if ( ( $paged >= 2 || $page >= 2 ) && ! is_404() ) {
$title .= " $sep " . sprintf( __( 'Page %s', 'phosphor' ), max( $paged, $page ) );
}
return $title;
}
add_filter( 'wp_title', 'phosphor_wp_title', 10, 2 );
/**
* Title shim for sites older than WordPress 4.1.
*
* @link https://make.wordpress.org/core/2014/10/29/title-tags-in-4-1/
* @todo Remove this function when WordPress 4.3 is released.
*/
function phosphor_render_title() {
?>
$item) {
$face = $item['value'];
if( strpos($key, 'font_family') !== false && array_key_exists($item['value'], phosphor_supported_google_fonts()) ) {
if( strpos($face, ',') ){
$face = explode(',', $item['value']);
$face = $face[0];
$face = str_replace("'", '', $face);
}
$face = str_replace(' ', '+', $face);
if( !in_array($face, $fonts) ){
$fonts[] = $face;
}
}
}
if( count($fonts) ){
wp_enqueue_style( 'phosphor-google-fonts', $url . implode('|', $fonts) );
}
}
add_action( 'wp_enqueue_scripts', 'phosphor_enqueue_google_fonts' );
/*
* Finds out which layout should be used for the current page.
*/
function phosphor_get_effective_layout() {
global $theme_settings;
$effective_layout = '';
if( $theme_settings['layouts']['general'] ) {
$effective_layout = $theme_settings['layouts']['general'];
}
if( is_singular() ){
if( $theme_settings['layouts']['single'] )
$effective_layout = $theme_settings['layouts']['single'];
if( is_single() && $theme_settings['layouts']['single_post'] ){
$effective_layout = $theme_settings['layouts']['single_post'];
}
if( is_page() && $theme_settings['layouts']['single_page'] ){
$effective_layout = $theme_settings['layouts']['single_page'];
}
$post = get_queried_object();
$post_meta = get_post_meta($post->ID, 'phosphor_options', true);
if( isset($post_meta['layout']) && $post_meta['layout'] ) {
$effective_layout = $post_meta['layout'];
}
}
if( is_archive() ){
if( $theme_settings['layouts']['archive'] )
$effective_layout = $theme_settings['layouts']['archive'];
if( is_category() && $theme_settings['layouts']['archive_category'] ){
$effective_layout = $theme_settings['layouts']['archive_category'];
}
if( is_tag() && $theme_settings['layouts']['archive_tag'] ){
$effective_layout = $theme_settings['layouts']['archive_tag'];
}
}
return ($effective_layout) ? $effective_layout : false;
}
function phosphor_dropdown_pages(){}