5 ) ); break; default: break; } } endif; add_action( 'business_center_pagination', 'business_center_pagination', 10 ); if ( ! function_exists( 'business_center_post_pagination' ) ) : /** * post pagination. * * @since Business Center 1.0.0 */ function business_center_post_pagination() { the_post_navigation(); } endif; add_action( 'business_center_action_post_pagination', 'business_center_post_pagination', 10 ); /** * long excerpt * * @since Business Center 1.0.0 * @return long excerpt value */ function business_center_excerpt_length(){ $options = business_center_get_theme_options(); $length = $options['excerpt_length']; return (int)$length; } add_filter( 'excerpt_length', 'business_center_excerpt_length', 999 ); /** * Excerpt read more text * * @since Business Center 1.0.0 * @return string Excerpt read more string */ function business_center_excerpt_more( $more ){ $options = business_center_get_theme_options(); $more = $options['read_more_text']; return ' ' . esc_html( $more ); } add_filter( 'excerpt_more', 'business_center_excerpt_more' ) .''; /** * custom excerpt function * * @since Business Center 1.0.0 * @return no of words to display */ function business_center_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( 'business_center_trim_content', $trimmed_content ); } if ( ! function_exists( 'business_center_is_jetpack_cpt_module_enable' ) ) : /** * Check if JetPack module is enabled * * @since Business Center 1.0.0 * * @param string $jetpack_cpt_option Jetpack enable checkbox value */ function business_center_is_jetpack_cpt_module_enable( $jetpack_cpt_option ) { if ( class_exists( 'Jetpack' ) && Jetpack::is_module_active( 'custom-content-types' ) && get_option( $jetpack_cpt_option ) ) : return true; endif; return false; } endif; add_action( 'plugins_loaded', 'business_center_is_jetpack_cpt_module_enable' ); add_filter( 'business_center_filter_is_jetpack_cpt_module_enable', 'business_center_is_jetpack_cpt_module_enable' ); if ( ! function_exists( 'business_center_footer_sidebar_class' ) ) : /** * Count the number of footer sidebars to enable dynamic classes for the footer * * @since Business Center 1.0.0 */ function business_center_footer_sidebar_class() { $data = array(); $active_id = array(); $count = 0; if ( is_active_sidebar( 'footer-1' ) ) { $active_id[] = '1'; $count++; } if ( is_active_sidebar( 'footer-2' ) ){ $active_id[] = '2'; $count++; } if ( is_active_sidebar( 'footer-3' ) ){ $active_id[] = '3'; $count++; } $class = ''; switch ( $count ) { case '1': $class = 'one'; break; case '2': $class = 'two'; break; case '3': $class = 'three'; break; default: $class = 'one'; break; } $data['active_id'] = $active_id; $data['class'] = $class; return $data; } endif; if ( ! function_exists( 'business_center_layout' ) ) : /** * Check home page layout option * * @since Business Center 1.0.0 * * @return string Layout value */ function business_center_layout() { $options = business_center_get_theme_options(); $sidebar_position = $options['sidebar_position']; $sidebar_position = apply_filters( 'business_center_sidebar_position', $sidebar_position ); // Check if single and static blog page if ( is_singular() || is_home() ) { if ( is_home() ) { $post_sidebar_position = get_post_meta( get_option( 'page_for_posts' ), 'business-center-sidebar-position', true ); } else { $post_sidebar_position = get_post_meta( get_the_ID(), 'business-center-sidebar-position', true ); } if ( isset( $post_sidebar_position ) && ! empty( $post_sidebar_position ) ) { $sidebar_position = $post_sidebar_position; } } return $sidebar_position; } endif; if ( ! function_exists( 'business_center_title_as_per_template' ) ) : /** * Return title as per template rendered * * @since Business Center 1.0.0 * * @return string Template title */ function business_center_title_as_per_template() { if ( is_single() ) { $categories_list = get_the_category_list( esc_html__( ', ', 'business-center' ) ); if ( $categories_list && business_center_categorized_blog() ) { printf( '