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 biancaa_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', 'biancaa' ), max( $paged, $page ) );
}
return $title;
}
add_filter( 'wp_title', 'biancaa_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 biancaa_render_title() {
?>
is_author() && isset( $wp_query->post ) ) {
$GLOBALS['authordata'] = get_userdata( $wp_query->post->post_author );
}
}
add_action( 'wp', 'biancaa_setup_author' );
/**
* Generates the relevant template info. Adds template meta with theme version. Uses the theme
* name and version from style.css.
*
* @since 1.0.0
*/
function biancaa_meta_template() {
$theme = wp_get_theme( get_template() );
$template = sprintf( '' . "\n", esc_attr( $theme->get( 'Name' ) ), esc_attr( $theme->get( 'Version' ) ) );
echo apply_filters( 'biancaa_meta_template', $template );
}
add_action( 'wp_head', 'biancaa_meta_template', 10 );
/**
* Removes default styles set by WordPress recent comments widget.
*
* @since 1.0.0
*/
function biancaa_remove_recent_comments_style() {
global $wp_widget_factory;
remove_action( 'wp_head', array( $wp_widget_factory->widgets['WP_Widget_Recent_Comments'], 'recent_comments_style' ) );
}
add_action( 'widgets_init', 'biancaa_remove_recent_comments_style' );
/**
* Change the excerpt more string.
*
* @since 1.0.0
* @param string $more
*/
function biancaa_excerpt_more( $more ) {
return '…';
}
add_filter( 'excerpt_more', 'biancaa_excerpt_more' );
/**
* Control the excerpt length.
*
* @since 1.0.0
* @param $length
*/
function biancaa_excerpt_length( $length ) {
return 70;
}
add_filter( 'excerpt_length', 'biancaa_excerpt_length', 999 );
/**
* Modifies the theme layout on archive and search pages.
*
* @since 1.0.0
* @param string $layout
*/
function biancaa_mod_theme_layout( $layout ) {
if ( is_archive() || is_search() ) {
$layout = '1c';
}
if ( is_page_template( 'page-templates/about.php' ) ) {
$layout = '1c';
}
return $layout;
}
add_filter( 'theme_mod_theme_layout', 'biancaa_mod_theme_layout', 15 );
/**
* Remove theme-layouts meta box on attachment post type.
*
* @since 1.0.0
*/
function biancaa_remove_theme_layout_metabox() {
remove_post_type_support( 'attachment', 'theme-layouts' );
}
add_action( 'init', 'biancaa_remove_theme_layout_metabox', 11 );
/**
* Register custom contact info fields.
*
* @since 1.0.0
* @param array $contactmethods
* @return array
*/
function biancaa_contact_info_fields( $contactmethods ) {
$contactmethods['facebook'] = 'Facebook';
$contactmethods['twitter'] = 'Twitter';
$contactmethods['linkedin'] = 'LinkedIn';
$contactmethods['dribbble'] = 'Dribbble';
return $contactmethods;
}
add_filter( 'user_contactmethods', 'biancaa_contact_info_fields' );