(.*?)<\/h2>#si', '', $content); return $content; } add_action('navigation_markup_template', 'business_champ_sanitize_pagination'); /** * Add a pingback url auto-discovery header for singularly identifiable articles. */ function business_champ_pingback_header() { if ( is_singular() && pings_open() ) { echo ''; } } add_action( 'wp_head', 'business_champ_pingback_header' ); if( ! function_exists('business_champ_oembed_result') ): function business_champ_oembed_result( $html, $url, $args = NULL ) { if( isset( $args['banner'] ) == 1 ){ $html = preg_replace('/width="\d+"/i', '' , $html ); $html = preg_replace('/height="\d+"/i', '' , $html ); return str_replace("?feature=oembed", "?feature=oembed&autoplay=1&controls=0&loop=1&rel=0&showinfo=0&mute=1", $html); }else if( isset($args['width'] ) ){ $html = preg_replace('/width="\d+"/i', 'width="'.$args['width'].'"' , $html ); $html = preg_replace('/height="\d+"/i', 'height="'.$args['height'].'" style="width:'.$args['width'].'px;height:'.$args['height'].'px;" ' , $html ); return $html; }else{ return $html; } } endif; add_filter('oembed_result','business_champ_oembed_result', 10, 3); if ( ! function_exists( 'business_champ_excerpt' ) ) : if(!is_admin()): function business_champ_excerpt( $text ) { $excerpt_words = esc_attr( get_theme_mod( 'exc_lenght' , 18 ) ); $excerpt_length = apply_filters( 'excerpt_length', $excerpt_words ); $excerpt_more = apply_filters( 'excerpt_more', ' ' . '...' ); $text = wp_trim_words( $text, $excerpt_length, $excerpt_more ); $text = apply_filters( 'get_the_excerpt', $text ); return '

'.$text.'

'; } endif; endif; add_action( 'the_excerpt', 'business_champ_excerpt', 10 ); if( ! function_exists('business_champ_slide_title') ): function business_champ_slide_title( $title , $control ){ $parts = explode( ' ', strip_tags( $title ) ); if( count( $parts ) === 1 ){ return '

'.$parts[0].'

'; }else if( count( $parts ) === 2 ){ return '

'.$parts[0].'

'.$parts[1].'

'; }else if( count( $parts ) === 3 ){ return '

'.$parts[0].'

'.$parts[1].'

'.$parts[2].'

'; }else{ $last_part = array_slice( $parts , 2 ); return '

'.$parts[0].'

'.$parts[1].'

'.implode(' ', $last_part ).'

'; } } endif; add_filter('business_champ_slide_title' , 'business_champ_slide_title', 10, 2); if( ! function_exists('business_champ_slide_subtitle') ): function business_champ_slide_subtitle( $subtitle , $control ){ $subtitle = strip_tags( $subtitle ); return '

'.$subtitle.'

'; } endif; add_filter('business_champ_slide_subtitle' , 'business_champ_slide_subtitle', 10, 2); if( ! function_exists('business_champ_url_to_id' ) ): function business_champ_url_to_id( $attachment_url ){ global $wpdb; $attachment = $wpdb->get_col($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE guid='%s';", $attachment_url )); if( isset( $attachment[0] ) ){ return $attachment[0]; } return false; } endif; add_filter( 'business_champ_url_to_id' , 'business_champ_url_to_id' , 10 , 1 ); if( ! function_exists( 'business_champ_id_to_cropped_url' ) ): function business_champ_id_to_cropped_url( $attachment_id, $size ){ $thumb = wp_get_attachment_image_src( $attachment_id, $size ); if( isset( $thumb[0] ) ){ return $thumb[0]; } return false; } endif; add_filter( 'business_champ_id_to_cropped_url' , 'business_champ_id_to_cropped_url' , 10 , 2 ); if ( ! function_exists( 'pinwheel_custom_posts_navigation' ) ) : /** * Posts navigation. * * @since 1.0.0 */ function business_champ_posts_navigation() { the_posts_pagination( array( 'mid_size' => 2, 'prev_text' => __( '', 'business-champ' ), 'next_text' => __( '', 'business-champ' ), 'screen_reader_text' => ' ' ) ); } endif; add_action( 'business_champ_posts_navigation' , 'business_champ_posts_navigation' ); if( ! function_exists('business_champ_footer_sidebars')): function business_champ_footer_sidebars(){ $columns = intval( esc_attr( get_theme_mod( 'footer_widget_areas' ) ) ); if( ! $columns ){ $columns = 4; } for( $i = 1; $i <= $columns; $i++): $args = array( 'name' => __( 'Footer Column ', 'business-champ' ) . $i, 'id' => 'business-champ-footer-'.$i, 'description' => '', 'class' => 'col footerCol', 'before_widget' => '
  • ', 'after_widget' => '
  • ', 'before_title' => '

    ', 'after_title' => '

    ' ); register_sidebar( $args ); endfor; } endif; add_action( 'init' , 'business_champ_footer_sidebars'); if( ! function_exists( 'business_champ_wp_title') ): function business_champ_wp_title( $title, $sep ) { if ( is_feed() ) { return $title; } global $page, $paged; // Add the blog name $title .= get_bloginfo( 'name', 'display' ); // Add the blog description for the home/front page. $site_description = get_bloginfo( 'description', 'display' ); if ( $site_description && ( is_home() || is_front_page() ) ) { $title .= " $sep $site_description"; } // Add a page number if necessary: if ( ( $paged >= 2 || $page >= 2 ) && ! is_404() ) { $title .= " $sep " . sprintf( __( 'Page %s', 'business-champ' ), max( $paged, $page ) ); } return $title; } endif; add_filter( 'wp_title', 'business_champ_wp_title', 10, 2 ); if( !function_exists('business_champ_add_widget_tabs')): function business_champ_add_widget_tabs($tabs){ $tabs[] = array( 'title' => __('Business Champ', 'business-champ'), 'filter' => array( 'groups' => array('themewidgets') ) ); return $tabs; } endif; add_filter('siteorigin_panels_widget_dialog_tabs', 'business_champ_add_widget_tabs', 20); if( ! function_exists( 'business-champ_archive_title') ): function multipurpose_archive_title( $title ){ if ( is_category() ) { $title = single_cat_title( '', false ); } elseif ( is_tag() ) { $title = single_tag_title( '', false ); } elseif ( is_author() ) { $title = get_the_author() ; } elseif( is_date() ){ $title = single_month_title( ' ' , false ); $title = implode( ', ', explode( ' ' , trim( $title ) ) ); } return $title; } endif; add_filter( 'get_the_archive_title', 'multipurpose_archive_title' , 10 ,1 ); if ( ! function_exists( 'business_champ_sidebars' ) ): /** * Returns array of registered sidebars */ function business_champ_sidebars() { global $wp_registered_sidebars; $arr = array(); if( !empty( $wp_registered_sidebars ) && is_array($wp_registered_sidebars) ){ foreach( $wp_registered_sidebars as $sidebar ): $arr[$sidebar['id']] = $sidebar['name']; endforeach; } return $arr; } endif; add_action('widgets_init','business_champ_sidebars' , 99); if ( ! function_exists( 'business_champ_recommend_plugin' ) ): function business_champ_recommend_plugin() { /** * Array of plugin arrays. Required keys are name and slug. */ $plugins = array( array( 'name' => esc_html__('Page Builder','business-champ'), 'slug' => 'siteorigin-panels', 'required' => false, ), array( 'name' => esc_html__('One Click Demo Import','business-champ'), 'slug' => 'one-click-demo-import', 'required' => false, ), array( 'name' => esc_html__( 'Contact Form 7', 'business-champ' ), 'slug' => 'contact-form-7', 'required' => false, ), array( 'name' => esc_html__( 'WooCommerce', 'business-champ' ), 'slug' => 'woocommerce', 'required' => false, ), ); $config = array( 'id' => 'business-champ', // Unique ID for hashing notices for multiple instances of TGMPA. 'default_path' => '', // Default absolute path to bundled plugins. 'menu' => 'tgmpa-install-plugins', // Menu slug. 'has_notices' => true, // Show admin notices or not. 'dismissable' => false, // If false, a user cannot dismiss the nag message. 'dismiss_msg' => '', // If 'dismissable' is false, this message will be output at top of nag. 'is_automatic' => false, // Automatically activate plugins after installation or not. 'message' => '', // Message to output right before the plugins table. ); tgmpa( $plugins, $config ); } endif; add_action( 'tgmpa_register', 'business_champ_recommend_plugin' ); /* * WooCommerce filters and actions */ if ( class_exists( 'WooCommerce' ) ) { remove_action( 'woocommerce_cart_collaterals', 'woocommerce_cross_sell_display' ); // Add them back UNDER the Cart Table add_action( 'woocommerce_cart_collaterals', 'woocommerce_cross_sell_display' , 99 ); if ( ! function_exists( 'business_champ_woocommerce_header_add_to_cart_fragment' ) ) : function business_champ_woocommerce_header_add_to_cart_fragment( $fragments ) { global $woocommerce; ob_start(); ?> cart->cart_contents_count; ?> >'; return $args; } endif; add_filter( 'woocommerce_pagination_args', 'business_champ_pagination' ); remove_action( 'woocommerce_sidebar', 'woocommerce_get_sidebar', 10 ); if ( ! function_exists( 'business_champ_wc_before_main_content' ) ) : function business_champ_wc_before_main_content(){ $sidebar = business_champ_shop_sidebar_pos(); if( ! $sidebar ){ $row = 'aGrid'; }else if($sidebar=='left'){ $row = 'col_2-30-70'; }else{ $row = 'col_2-70-30'; } get_template_part( 'template-parts/banner' ); echo '
    '; if( $sidebar == 'left' ): get_sidebar(); endif; echo '
    '; } endif; add_action('woocommerce_before_main_content', 'business_champ_wc_before_main_content' , 1); if ( ! function_exists( 'business_champ_wc_after_main_content' ) ) : function business_champ_wc_after_main_content(){ $sidebar = business_champ_shop_sidebar_pos(); echo '
    '; if( $sidebar == 'right' ): get_sidebar(); endif; echo '
    '; } endif; add_action('woocommerce_after_main_content', 'business_champ_wc_after_main_content' , 99); }