';
}
add_action('woocommerce_after_main_content', 'newsmagz_woocommerce_wrapper_main_end', 11);
function newsmagz_woocommerce_wrapper_main_end() {
echo '
';
}
add_action('woocommerce_sidebar', 'newsmagz_woocommerce_wrapper_end', 11);
function newsmagz_woocommerce_wrapper_end() {
echo '
';
}
function bfastmag_customize_register_child( $wp_customize ) {
/* $wp_customize->add_panel( 'featured_panel', array(
'priority' => 35,
'capability' => 'edit_theme_options',
'title' => esc_html__( 'Featured Blocks', 'bfastmag' ),
) );*/
$wp_customize->remove_panel('bfastmag_featured_big');
$wp_customize->remove_panel('featured_panel');
$wp_customize->remove_section('bfastmag_block1');
$wp_customize->remove_control('bfastmag_block2_category');
$wp_customize->get_section( 'bfastmag_block2' )->title = __( 'Latest Products or Category', 'bfastmag' );
$wp_customize->get_section( 'bfastmag_block3' )->title = __( 'Products Slider', 'bfastmag' );
$wp_customize->get_section( 'bfastmag_block4' )->title = __( 'Category Block', 'bfastmag' );
$wp_customize->add_section( 'bfastmag_featured_big', array(
'title' => esc_html__( 'Shop Home Big Grid', 'bfastmag' ),
'priority' => 1,
'panel' => 'featured_panel',
) );
$wp_customize->add_section( 'bfastmag_featured_slider', array(
'title' => esc_html__( 'Featured Home Slider', 'bfastmag' ),
'priority' => 1,
'panel' => 'featured_panel',
) );
$wp_customize->add_section( 'bfastmag_banners', array(
'title' => esc_html__( ' Home Banners', 'bfastmag' ),
'priority' => 1,
'panel' => 'sections_panel',
) );
$wp_customize->add_setting( 'bfastmag_shop_banners', array(
'transport' => 'postMessage',
'sanitize_callback' => 'bfastmag_sanitize_repeater',
) );
$wp_customize->add_control( new bfastmag_General_Repeater_banner( $wp_customize, 'bfastmag_shop_banners', array(
'label' => esc_html__( 'Add New Shop Banner', 'bfastmag' ),
'section' => 'bfastmag_banners',
'priority' => 1,
'bfastmag_bannerlink_control' => true,
'bfastmag_link_control' => true,
) ) );
$wp_customize->add_setting( 'bfastmag_block22_category', array(
'default' => 'all',
'transport' => 'postMessage',
'sanitize_callback' => 'bfastmag_sanitize_category_dropdown2',
) );
$wp_customize->add_control( new bfastmagChooseCategoryPro( $wp_customize, 'bfastmag_block22_category', array(
'label' => esc_html__( 'Category', 'bfastmag' ),
'section' => 'bfastmag_block2',
'priority' => 4,
) ) );
}
add_action( 'customize_register', 'bfastmag_customize_register_child' ,1000);
/**
* Sanitize dropdown.
*
* @param string $input Category slug.
*
* @return string
*/
function bfastmag_sanitize_category_dropdown2( $input ) {
/* $cat = get_category_by_slug( $input );
if ( empty( $cat ) ) {
return 'all';
}*/
return $input;
}
if ( ! class_exists( 'WP_Customize_Control' ) ) {
return null;
}
/**
* Class bfastmagChooseCategory
*/
class bfastmagChooseCategoryPro extends WP_Customize_Control {
/**
* bfastmagChooseCategory constructor.
*
* @param WP_Customize_Manager $manager WordPress manager.
* @param string $id Control id.
* @param array $args Control arguments.
*/
public function __construct( $manager, $id, $args = array() ) {
parent::__construct( $manager, $id, $args );
}
/**
* Render the content on the theme customizer page
*/
public function render_content() {
$taxonomy = 'product_cat';
$orderby = 'name';
$show_count = 0; // 1 for yes, 0 for no
$pad_counts = 0; // 1 for yes, 0 for no
$hierarchical = 1; // 1 for yes, 0 for no
$title = '';
$empty = 0;
$args2 = array(
'taxonomy' => $taxonomy,
'child_of' => 0,
'parent' => '',
'orderby' => $orderby,
'show_count' => $show_count,
'pad_counts' => $pad_counts,
'hierarchical' => $hierarchical,
'title_li' => $title,
'hide_empty' => $empty
);
$categories = get_categories( $args2 );
?>
label ); ?>
boxtitle = __( 'banner','bfastmag' );
if ( ! empty( $args['bfastmag_bannerlink_control'] ) ) {
$this->customizer_repeater_icon_control = $args['bfastmag_bannerlink_control'];
}
if ( ! empty( $args['bfastmag_link_control'] ) ) {
$this->customizer_repeater_link_control = $args['bfastmag_link_control'];
}
if ( ! empty( $args['id'] ) ) {
$this->id = $id;
}
}
/**
* Enqueue resources for the control
*/
public function enqueue() {
wp_enqueue_script( 'customizer-repeater-script', get_stylesheet_directory_uri() . '/inc/customizer/customizer_repeater.js', array( 'jquery', 'jquery-ui-draggable' ), '1.0.1', true );
}
/**
* The function to render the controler
*/
public function render_content() {
/*Get default options*/
$this_default = json_decode( $this->setting->default );
/*Get values (json format)*/
$values = $this->value();
/*Decode values*/
$json = json_decode( $values );
if ( ! is_array( $json ) ) {
$json = array( $values );
} ?>
label ); ?>
iterate_array( $this_default ); ?>
link(); ?>
class="customizer-repeater-colector"
value=""/>
iterate_array(); ?>
link(); ?>
class="bfastmag_repeater_colector"/>
iterate_array( $json ); ?>
link(); ?>
class="bfastmag_repeater_colector" value="value() ); ?>"/>
icon_value ) ) {
$box_title = $icon->icon_value;
}else{
$box_title = $this->boxtitle;
}
echo esc_html( $box_title );
?>
id ) ) {
$id = $icon->id;
}
if ( ! empty( $icon->icon_value ) ) {
$icon_value = $icon->icon_value;
}
if ( ! empty( $icon->image_url ) ) {
$image_url = $icon->image_url;
}
if ( ! empty( $icon->link ) ) {
$link = $icon->link;
}
$this->image_control( $image_url, 'image' );
if ( $this->customizer_repeater_link_control ) {
$this->input_control(array(
'label' => __( 'Banner Link','bfastmag' ),
'class' => 'bfastmag_link_control',
'sanitize_callback' => 'esc_url',
), $link);
} ?>
boxtitle ); ?>
image_control();
if ( $this->customizer_repeater_link_control == true ) {
$this->input_control( array(
'label' => __( 'Banner Link', 'bfastmag' ),
'class' => 'bfastmag_link_control',
) );
} ?>