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) { ?>