'; } } add_action( 'wp_head', 'education_care_pingback_header' ); /** * Filter to check home page content */ if ( ! function_exists( 'education_care_show_home_content' ) ) : /** * Check home page content status. * */ function education_care_show_home_content( $status ) { if ( is_front_page() ) { $show_home_content = education_care_options( 'home_content' ); if ( false === $show_home_content ) { $status = false; } } return $status; } endif; add_action( 'education_care_show_home_page_content', 'education_care_show_home_content' ); if ( ! function_exists( 'education_care_implement_excerpt_length' ) ) : /** * Implement excerpt length. * * @since 1.0.0 * * @param int $length The number of words. * @return int Excerpt length. */ function education_care_implement_excerpt_length( $length ) { $excerpt_length = education_care_options( 'excerpt_length' ); if ( absint( $excerpt_length ) > 0 ) { $length = absint( $excerpt_length ); } return $length; } endif; if ( ! function_exists( 'education_care_implement_read_more' ) ) : /** * Implement read more in excerpt. * * @since 1.0.0 * * @param string $more The string shown within the more link. * @return string The excerpt. */ function education_care_implement_read_more( $more ) { $output = $more; $output = '…'; return $output; } endif; if ( ! function_exists( 'education_care_hook_read_more_filters' ) ) : /** * Hook read more and excerpt length filters. * * @since 1.0.0 */ function education_care_hook_read_more_filters() { if ( is_home() || is_category() || is_tag() || is_author() || is_date() || is_search() ) { add_filter( 'excerpt_length', 'education_care_implement_excerpt_length', 999 ); add_filter( 'excerpt_more', 'education_care_implement_read_more' ); } } endif; add_action( 'wp', 'education_care_hook_read_more_filters' ); //============================================================= // Exclude category in blog page //============================================================= if( ! function_exists( 'education_care_exclude_category_in_blog_page' ) ) : /** * Exclude category in blog page * * @since Education_Care 1.0.0 */ function education_care_exclude_category_in_blog_page( $query ) { if( $query->is_main_query() && ( $query->is_home || $query->is_archive() ) ) { $exclude_categories = education_care_options( 'exclude_cats' ); if ( ! empty( $exclude_categories ) ) { $cats = str_replace(', ', ',', $exclude_categories); $cats = str_replace(' , ', ',', $exclude_categories); $cats = explode( ',', $cats ); $cats = array_filter( $cats, 'is_numeric' ); $string_exclude = ''; if ( ! empty( $cats ) ) { $string_exclude = '-' . implode( ',-', $cats); $query->set( 'cat', $string_exclude ); } } } return $query; } endif; add_filter( 'pre_get_posts', 'education_care_exclude_category_in_blog_page' ); function education_care_exclude_posts_recent_post_widget( $args ){ $exclude_categories = education_care_options( 'exclude_cats' ); if ( ! empty( $exclude_categories ) ) { $cats = str_replace(', ', ',', $exclude_categories); $cats = str_replace(' , ', ',', $exclude_categories); $cats = explode( ',', $cats ); $cats = array_filter( $cats, 'is_numeric' ); $args['category__not_in'] = $cats; } return $args; } add_filter( 'widget_posts_args', 'education_care_exclude_posts_recent_post_widget'); //Hide categories from WordPress category widget function education_care_exclude_widget_categories($args){ $exclude_categories = education_care_options( 'exclude_cats' ); if ( ! empty( $exclude_categories ) ) { $cats = str_replace(', ', ',', $exclude_categories); $cats = str_replace(' , ', ',', $exclude_categories); $cats = explode( ',', $cats ); $cats = array_filter( $cats, 'is_numeric' ); $args['exclude'] = $cats; } return $args; } add_filter( 'widget_categories_args', 'education_care_exclude_widget_categories' ); if ( ! function_exists( 'education_care_gotop' ) ) : function education_care_gotop() { echo ''; } endif; add_action( 'wp_footer', 'education_care_gotop' );