b0y-101 Mini Shell


Current Path : E:/www2/tcas/wp-content/themes/businesszen/inc/customizer/sections/
File Upload :
Current File : E:/www2/tcas/wp-content/themes/businesszen/inc/customizer/sections/latest-posts.php

<?php
/**
 * Latest Posts Section options
 *
 * @package Theme Palace
 * @subpackage Businesszen
 * @since Businesszen 1.0.0
 */

// Add Latest Posts section
$wp_customize->add_section( 'businesszen_latest_posts_section', array(
	'title'             => esc_html__( 'Latest Posts','businesszen' ),
	'description'       => esc_html__( 'Latest Posts Section options.', 'businesszen' ),
	'panel'				=> 'businesszen_front_page_panel',
) );

// Latest Posts content enable control and setting
$wp_customize->add_setting( 'businesszen_theme_options[latest_posts_section_enable]', array(
	'default'			=> 	$options['latest_posts_section_enable'],
	'sanitize_callback' => 'businesszen_sanitize_switch_control',
) );

$wp_customize->add_control( new Businesszen_Switch_Control( $wp_customize, 'businesszen_theme_options[latest_posts_section_enable]', array(
	'label'             => esc_html__( 'Latest Posts Section Enable', 'businesszen' ),
	'section'           => 'businesszen_latest_posts_section',
	'on_off_label' 		=> businesszen_switch_options(),
) ) );

// Latest Posts btn label setting and control
$wp_customize->add_setting( 'businesszen_theme_options[latest_posts_sub_title]', array(
	'sanitize_callback' => 'sanitize_text_field',
	'default'			=> $options['latest_posts_sub_title'],
	'transport'			=> 'postMessage',
) );

$wp_customize->add_control( 'businesszen_theme_options[latest_posts_sub_title]', array(
	'label'           	=> esc_html__( 'Section Sub Title', 'businesszen' ),
	'section'        	=> 'businesszen_latest_posts_section',
	'active_callback' 	=> 'businesszen_is_latest_posts_section_enable',
	'type'				=> 'text',
) );

// Abort if selective refresh is not available.
if ( isset( $wp_customize->selective_refresh ) ) {
    $wp_customize->selective_refresh->add_partial( 'businesszen_theme_options[latest_posts_sub_title]', array(
		'selector'            => '#businesszen_latest_posts_section p.section-subtitle',
		'settings'            => 'businesszen_theme_options[latest_posts_sub_title]',
		'container_inclusive' => false,
		'fallback_refresh'    => true,
		'render_callback'     => 'businesszen_latest_posts_sub_title_partial',
    ) );
}

// Latest Posts btn label setting and control
$wp_customize->add_setting( 'businesszen_theme_options[latest_posts_title]', array(
	'sanitize_callback' => 'sanitize_text_field',
	'default'			=> $options['latest_posts_title'],
	'transport'			=> 'postMessage',
) );

$wp_customize->add_control( 'businesszen_theme_options[latest_posts_title]', array(
	'label'           	=> esc_html__( 'Section Title', 'businesszen' ),
	'section'        	=> 'businesszen_latest_posts_section',
	'active_callback' 	=> 'businesszen_is_latest_posts_section_enable',
	'type'				=> 'text',
) );

// Abort if selective refresh is not available.
if ( isset( $wp_customize->selective_refresh ) ) {
    $wp_customize->selective_refresh->add_partial( 'businesszen_theme_options[latest_posts_title]', array(
		'selector'            => '#businesszen_latest_posts_section h2.section-title',
		'settings'            => 'businesszen_theme_options[latest_posts_title]',
		'container_inclusive' => false,
		'fallback_refresh'    => true,
		'render_callback'     => 'businesszen_latest_posts_title_partial',
    ) );
}

// Latest Posts content type control and setting
$wp_customize->add_setting( 'businesszen_theme_options[latest_posts_content_type]', array(
	'default'          	=> $options['latest_posts_content_type'],
	'sanitize_callback' => 'businesszen_sanitize_select',
) );

$wp_customize->add_control( 'businesszen_theme_options[latest_posts_content_type]', array(
	'label'             => esc_html__( 'Content Type', 'businesszen' ),
	'section'           => 'businesszen_latest_posts_section',
	'type'				=> 'select',
	'active_callback' 	=> 'businesszen_is_latest_posts_section_enable',
	'choices'			=> array(
		'post'      => esc_html__( 'Post', 'businesszen' ),
		'category'  => esc_html__( 'Category', 'businesszen' ),
		),
) );

for ( $i = 1; $i <= 3; $i++ ) :

	// latest_posts posts drop down chooser control and setting
	$wp_customize->add_setting( 'businesszen_theme_options[latest_posts_content_post_' . $i . ']', array(
		'sanitize_callback' => 'businesszen_sanitize_page',
	) );

	$wp_customize->add_control( new Businesszen_Dropdown_Chooser( $wp_customize, 'businesszen_theme_options[latest_posts_content_post_' . $i . ']', array(
		'label'             => sprintf( esc_html__( 'Select Post %d', 'businesszen' ), $i ),
		'section'           => 'businesszen_latest_posts_section',
		'choices'			=> businesszen_post_choices(),
		'active_callback'	=> 'businesszen_is_latest_posts_section_content_post_enable',
	) ) );

endfor;

// Add dropdown category setting and control.
$wp_customize->add_setting(  'businesszen_theme_options[latest_posts_content_category]', array(
	'sanitize_callback' => 'businesszen_sanitize_single_category',
) ) ;

$wp_customize->add_control( new Businesszen_Dropdown_Taxonomies_Control( $wp_customize,'businesszen_theme_options[latest_posts_content_category]', array(
	'label'             => esc_html__( 'Select Category', 'businesszen' ),
	'description'      	=> esc_html__( 'Note: Latest selected no of posts will be shown from selected category', 'businesszen' ),
	'section'           => 'businesszen_latest_posts_section',
	'type'              => 'dropdown-taxonomies',
	'active_callback'	=> 'businesszen_is_latest_posts_section_content_category_enable'
) ) );

// about btn title setting and control
$wp_customize->add_setting( 'businesszen_theme_options[latest_posts_btn_title]', array(
	'sanitize_callback' => 'sanitize_text_field',
	'default'			=> $options['latest_posts_btn_title'],
	'transport'			=> 'postMessage',
) );

$wp_customize->add_control( 'businesszen_theme_options[latest_posts_btn_title]', array(
	'label'           	=> esc_html__( 'Button Label', 'businesszen' ),
	'section'        	=> 'businesszen_latest_posts_section',
	'active_callback' 	=> 'businesszen_is_latest_posts_section_enable',
	'type'				=> 'text',
) );

// Abort if selective refresh is not available.
if ( isset( $wp_customize->selective_refresh ) ) {
    $wp_customize->selective_refresh->add_partial( 'businesszen_theme_options[latest_posts_btn_title]', array(
		'selector'            => '#businesszen_latest_posts_section a.btn',
		'settings'            => 'businesszen_theme_options[latest_posts_btn_title]',
		'container_inclusive' => false,
		'fallback_refresh'    => true,
		'render_callback'     => 'businesszen_latest_posts_btn_title_partial',
    ) );
}

// about btn link setting and control
$wp_customize->add_setting( 'businesszen_theme_options[latest_posts_btn_link]', array(
	'sanitize_callback' => 'esc_url_raw',
) );

$wp_customize->add_control( 'businesszen_theme_options[latest_posts_btn_link]', array(
	'label'           	=> esc_html__( 'Button Link', 'businesszen' ),
	'section'        	=> 'businesszen_latest_posts_section',
	'active_callback' 	=> 'businesszen_is_latest_posts_section_enable',
	'type'				=> 'url',
) );

Copyright © 2019 by b0y-101