'; } } add_action( 'wp_head', 'business_cube_pingback_header' ); //============================================================= // Function to change default excerpt //============================================================= if ( ! function_exists( 'business_cube_implement_excerpt_length' ) ) : /** * Implement excerpt length. * * @since 1.0.0 * * @param int $length The number of words. * @return int Excerpt length. */ function business_cube_implement_excerpt_length( $length ) { $excerpt_length = business_cube_get_option( 'excerpt_length' ); if ( absint( $excerpt_length ) > 0 ) { $length = absint( $excerpt_length ); } return $length; } endif; if ( ! function_exists( 'business_cube_content_more_link' ) ) : /** * Implement read more in content. * * @since 1.0.0 * * @param string $more_link Read More link element. * @param string $more_link_text Read More text. * @return string Link. */ function business_cube_content_more_link( $more_link, $more_link_text ) { $read_more_text = business_cube_get_option('readmore_text'); if ( ! empty( $read_more_text ) ) { $more_link = str_replace( $more_link_text, esc_html( $read_more_text ), $more_link ); } return $more_link; } endif; if ( ! function_exists( 'business_cube_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 business_cube_implement_read_more( $more ) { $output = $more; $read_more_text = business_cube_get_option('readmore_text'); if ( is_home() && ! empty( $read_more_text ) ) { $output = '…

' . esc_html( $read_more_text ) . '

'; } return $output; } endif; if ( ! function_exists( 'business_cube_hook_read_more_filters' ) ) : /** * Hook read more and excerpt length filters. * * @since 1.0.0 */ function business_cube_hook_read_more_filters() { add_filter( 'excerpt_length', 'business_cube_implement_excerpt_length', 999 ); add_filter( 'the_content_more_link', 'business_cube_content_more_link', 10, 2 ); add_filter( 'excerpt_more', 'business_cube_implement_read_more' ); } endif; add_action( 'wp', 'business_cube_hook_read_more_filters' ); if ( ! function_exists( 'business_cube_get_option' ) ) : /** * Get theme option. * * @since 1.0.0 * * @param string $key Option key. * @return mixed Option value. */ function business_cube_get_option( $key ) { if ( empty( $key ) ) { return; } //default theme options $defaults = array(); $defaults['featured_section_enable'] = true; $defaults['featured_content_type'] = 'page'; $defaults['featured_section_count'] = 3; $defaults['about_section_enable'] = true; $defaults['about_content_type'] = 'page'; $defaults['about_section_count'] = 1; $defaults['services_section_enable'] = true; $defaults['services_column'] = 'col-3'; $defaults['services_content_type'] = 'page'; $defaults['services_section_count'] = 3; $defaults['cta_section_enable'] = true; $defaults['cta_content_type'] = 'page'; $defaults['blog_section_enable'] = true; $defaults['blog_column'] = '3'; $defaults['blog_content_type'] = 'post'; $defaults['blog_section_count'] = 3; $defaults['header_title_color'] = '#000'; $defaults['header_tagline_color'] = '#000'; $defaults['site_identity'] = 'title-text'; $defaults['global_layout'] = 'right-sidebar'; $defaults['excerpt_length'] = 40; $defaults['readmore_text'] = esc_html__( 'Read More', 'business-cube' ); $defaults['copyright_text'] = esc_html__( 'Copyright © All rights reserved.', 'business-cube' ); //get theme options and use default if theme option not set $theme_options = get_theme_mod( 'theme_options', $defaults ); $theme_options = array_merge( $defaults, $theme_options ); $value = ''; if ( isset( $theme_options[ $key ] ) ) { $value = $theme_options[ $key ]; } return $value; } endif; /** * Set up the WordPress core custom header feature. * * @uses business_cube_pro_header_style() */ function business_cube_custom_header_setup() { add_theme_support( 'custom-header', apply_filters( 'business_cube_pro_custom_header_args', array( 'default-text-color' => 'fff', 'width' => 1200, 'height' => 528, 'flex-height' => true, 'wp-head-callback' => 'business_cube_header_style', ) ) ); } add_action( 'after_setup_theme', 'business_cube_custom_header_setup' ); if ( ! function_exists( 'business_cube_header_style' ) ) : /** * Styles the header image and text displayed on the blog. * * @see maya_blog_custom_header_setup(). */ function business_cube_header_style() { $header_text_color = get_header_textcolor(); /* * If no custom options for text are set, let's bail. * get_header_textcolor() options: Any hex value, 'blank' to hide text. Default: add_theme_support( 'custom-header' ). */ if ( get_theme_support( 'custom-header', 'default-text-color' ) === $header_text_color ) { return; } // If we get this far, we have custom styles. Let's do this. ?>