false, 'show_title' => true, 'show_browse' => false, ); breadcrumb_trail( $args ); return; } endif; add_action( 'kids_education_action_pagination', 'kids_education_pagination', 10 ); if ( ! function_exists( 'kids_education_pagination' ) ) : /** * pagination. * * @since Kids Education 0.1 */ function kids_education_pagination() { $options = kids_education_get_theme_options(); if ( true == $options['pagination_enable'] ) { $pagination = $options['pagination_type']; if ( $pagination == 'default' ) : the_posts_navigation(); elseif ( $pagination == 'numeric' ) : the_posts_pagination( array( 'mid_size' => 2, 'prev_text' => esc_html__( 'Previous', 'kids-education' ), 'next_text' => esc_html__( 'Next', 'kids-education' ), ) ); endif; } } endif; add_action( 'kids_education_action_post_pagination', 'kids_education_post_pagination', 10 ); if ( ! function_exists( 'kids_education_post_pagination' ) ) : /** * post pagination. * * @since Kids Education 0.1 */ function kids_education_post_pagination() { $options = kids_education_get_theme_options(); // get theme options if( $options['post_navigation_enable'] ){ $args = array( 'prev_text' => esc_html__( 'Prev Post', 'kids-education' ), 'next_text' => esc_html__( 'Next Post', 'kids-education' ), 'screen_reader_text' => esc_html__( 'Continue Reading', 'kids-education' ), ); if( 'post_title' == $options['post_navigation_type'] ){ $args = array( 'prev_text' => esc_html__( '%title', 'kids-education' ), 'next_text' => esc_html__( '%title', 'kids-education' ), 'screen_reader_text' => esc_html__( 'Continue Reading', 'kids-education' ), ); } the_post_navigation( $args ); } } endif; /** * long excerpt * * @since Kids Education 0.1 * @return long excerpt value */ function kids_education_excerpt_length(){ $options = kids_education_get_theme_options(); $length = $options['long_excerpt_length']; return $length; } /** * create the custom excerpts callback * * @since Kids Education 0.1 * @return custom excerpts callback */ function kids_education_custom_excerpt( $length_callback = '', $more_callback = '' ){ $post_id = get_the_ID(); if ( function_exists( $length_callback ) ){ add_filter( 'excerpt_length', $length_callback ); } $output = get_the_excerpt( $post_id ); $output = apply_filters( 'wptexturize', $output ); $output = apply_filters( 'convert_chars', $output ); $output = $output; echo esc_html( $output ); } // read more function kids_education_excerpt_more( $more ){ return '...'; } add_filter( 'excerpt_more', 'kids_education_excerpt_more' ); /** * custom excerpt function * * @since Kids Education 0.1 * @return no of words to display */ function kids_education_trim_content( $length = 40, $post_obj = null ) { global $post; if ( is_null( $post_obj ) ) { $post_obj = $post; } $length = absint( $length ); if ( $length < 1 ) { $length = 40; } $source_content = $post_obj->post_content; if ( ! empty( $post_obj->post_excerpt ) ) { $source_content = $post_obj->post_excerpt; } $source_content = preg_replace( '`\[[^\]]*\]`', '', $source_content ); $trimmed_content = wp_trim_words( $source_content, $length, '...' ); return apply_filters( 'kids_education_trim_content', $trimmed_content ); } if ( ! function_exists( 'kids_education_custom_content_width' ) ) : /** * Custom content width. * * @since Kids Education 0.1 */ function kids_education_custom_content_width() { global $content_width; if ( ! is_active_sidebar( 'sidebar-1' ) ) { $content_width = 1170; }else { $content_width = 819; } } endif; add_action( 'template_redirect', 'kids_education_custom_content_width' ); if ( ! function_exists( 'kids_education_get_thumbnail_image' ) ) : /** * display post or page thumbnail image * * @since Kids Education 0.1 * * @return string value */ function kids_education_get_thumbnail_image() { if ( post_password_required() || is_attachment() ) { return; } if ( is_singular() ) { if( has_post_thumbnail() ){ the_post_thumbnail( 'full', array( 'alt' => the_title_attribute( 'echo=0' ) ) ); } } elseif( is_home() ){ ?>
ID ); // get category object $category_ids = array(); // set an empty array foreach ( $post_categories as $post_category ) { $category_ids[] = $post_category->term_id; } if( empty( $category_ids ) ) return; $qargs = array( 'posts_per_page' => 2, 'category__in' => $category_ids, 'post__not_in' => array( $post->ID ), 'order' => 'ASC', 'orderby' => 'rand' ); $related_posts = get_posts( $qargs ); // custom posts ?>