'; return $form; } endif; add_filter( 'get_search_form', 'belly_customize_search_form', 15 ); if ( ! function_exists( 'belly_exclude_category_in_blog_page' ) ) : function belly_exclude_category_in_blog_page( $query ) { if ( $query->is_home && $query->is_main_query() ) { $exclude_categories = belly_get_option( 'exclude_categories' ); if ( ! empty( $exclude_categories ) ) { $cats = explode( ',', $exclude_categories ); $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', 'belly_exclude_category_in_blog_page' ); if ( ! function_exists( 'belly_implement_excerpt_length' ) ) : function belly_implement_excerpt_length( $length ) { global $post; //Post type must be 'post'. $post_type = get_post_type($post); if ( is_admin() ) { return $length; } elseif ( ( is_home() || is_archive() ) && ($post_type == 'post') ) { $excerpt_length = belly_get_option( 'excerpt_length' ); $excerpt_length = apply_filters( 'belly_filter_excerpt_length', $excerpt_length ); if ( absint( $excerpt_length ) > 0 ) { $length = absint( $excerpt_length ); } } return $length; } endif; add_filter( 'excerpt_length', 'belly_implement_excerpt_length', 999 ); if ( ! function_exists( 'belly_implement_read_more' ) ) : function belly_implement_read_more( $more ) { if ( is_admin() ) { return $more; } return '…'; } endif; add_filter( 'excerpt_more', 'belly_implement_read_more' ); if ( ! function_exists( 'belly_content_more_link' ) ) : function belly_content_more_link( $more_link, $more_link_text ) { if ( is_admin() ) { return $more_link; } return '…'; } endif; add_filter( 'the_content_more_link', 'belly_content_more_link', 10, 2 ); if ( ! function_exists( 'belly_custom_body_class' ) ) : function belly_custom_body_class( $input ) { // Adds a class of group-blog to blogs with more than 1 published author. if ( is_multi_author() ) { $input[] = 'group-blog'; } // Site layout. $site_layout = belly_get_option( 'site_layout' ); $input[] = 'site-layout-' . esc_attr( $site_layout ); // Global layout. global $post; $global_layout = belly_get_option( 'global_layout' ); $global_layout = apply_filters( 'belly_filter_theme_global_layout', $global_layout ); // Check if single template. if ( $post && is_singular() ) { $post_options = get_post_meta( $post->ID, 'belly_settings', true ); if ( isset( $post_options['post_layout'] ) && ! empty( $post_options['post_layout'] ) ) { $global_layout = $post_options['post_layout']; } } $input[] = 'global-layout-' . esc_attr( $global_layout ); // Common class for three columns. switch ( $global_layout ) { case 'three-columns': $input[] = 'three-columns-enabled'; break; default: break; } // Header add status class. if ( is_active_sidebar( 'sidebar-header-right-widget-area' ) ) { $input[] = 'header-ads-enabled'; } else { $input[] = 'header-ads-disabled'; } return $input; } endif; add_filter( 'body_class', 'belly_custom_body_class' ); if ( ! function_exists( 'belly_custom_content_width' ) ) : function belly_custom_content_width() { global $post, $wp_query, $content_width; $global_layout = belly_get_option( 'global_layout' ); $global_layout = apply_filters( 'belly_filter_theme_global_layout', $global_layout ); // Check if single template. if ( $post && is_singular() ) { $post_options = get_post_meta( $post->ID, 'belly_settings', true ); if ( isset( $post_options['post_layout'] ) && ! empty( $post_options['post_layout'] ) ) { $global_layout = $post_options['post_layout']; } } switch ( $global_layout ) { case 'no-sidebar': $content_width = 1220; break; case 'three-columns': $content_width = 570; break; case 'left-sidebar': case 'right-sidebar': $content_width = 895; break; default: break; } } endif; add_filter( 'template_redirect', 'belly_custom_content_width' );