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 blackwhite_lite_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', 'blackwhite-lite' ), max( $paged, $page ) ); } return $title; } add_filter( 'wp_title', 'blackwhite_lite_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 blackwhite_lite_render_title() { ?> <?php wp_title( '|', true, 'right' ); ?> 0 ? intval ($theme_options['excerpt_length']) : $length; return $number; } add_filter( 'excerpt_length', 'blackwhite_lite_excerpt_length', 999 ); function blackwhite_lite_excerpt_more( $more ) { $theme_options = blackwhite_lite_theme_options(); return $theme_options['excerpt_more']; } add_filter('excerpt_more', 'blackwhite_lite_excerpt_more'); /** |------------------------------------------------------------------------------ | Related Posts |------------------------------------------------------------------------------ | | You can show related posts by Categories or Tags. | | 1. Thumbnail related posts (default) | 2. List of related posts | | @return void | */ if (! function_exists('blackwhite_lite_related_posts') ): function blackwhite_lite_related_posts() { global $post; $theme_options = blackwhite_lite_theme_options(); $taxonomy = $theme_options['related_posts']; $args = array(); if ($taxonomy == 'tag') { $tags = wp_get_post_tags($post->ID); $arr_tags = array(); foreach($tags as $tag) { array_push($arr_tags, $tag->term_id); } if (!empty($arr_tags)) { $args = array( 'tag__in' => $arr_tags, 'post__not_in' => array($post->ID), 'posts_per_page'=> 4, ); } } else { $args = array( 'category__in' => wp_get_post_categories($post->ID), 'posts_per_page' => 4, 'post__not_in' => array($post->ID) ); } if (! empty($args) ) { $posts = get_posts($args); if ($posts) { ?>
cat_ID] = $cat->name; } return $cats; }