File: /var/www/html/wptrinityconsulting/wp-content/themes/finbuzz/inc/customizer/settings/single.php
<?php
/**
* @author RadiusTheme
* @since 1.0
* @version 1.0
*/
namespace radiustheme\finbuzz\Customizer\Settings;
use radiustheme\finbuzz\Customizer\FinbuzzTheme_Customizer;
use radiustheme\finbuzz\Customizer\Controls\Customizer_Heading_Control;
use radiustheme\finbuzz\Customizer\Controls\Customizer_Switch_Control;
use radiustheme\finbuzz\Customizer\Controls\Customizer_Image_Radio_Control;
/**
* Adds the individual sections, settings, and controls to the theme customizer
*/
class FinbuzzTheme_Blog_Single_Post_Settings extends FinbuzzTheme_Customizer {
public function __construct() {
parent::instance();
$this->populated_default_data();
// Add Controls
add_action( 'customize_register', array( $this, 'register_blog_single_post_controls' ) );
}
/**
* Blog Post Controls
*/
public function register_blog_single_post_controls( $wp_customize ) {
// Post Style
$wp_customize->add_setting( 'post_style',
array(
'default' => $this->defaults['post_style'],
'transport' => 'refresh',
'sanitize_callback' => 'rttheme_radio_sanitization'
)
);
$wp_customize->add_control( new Customizer_Image_Radio_Control( $wp_customize, 'post_style',
array(
'label' => __( 'Single Post Layout', 'finbuzz' ),
'description' => esc_html__( 'Post single layout variation you can selecr and use.', 'finbuzz' ),
'section' => 'single_post_secttings_section',
'choices' => array(
'style1' => array(
'image' => trailingslashit( get_template_directory_uri() ) . 'assets/img/post-style-1.png',
'name' => __( 'Layout 1', 'finbuzz' )
),
'style2' => array(
'image' => trailingslashit( get_template_directory_uri() ) . 'assets/img/post-style-3.png',
'name' => __( 'Layout 2', 'finbuzz' )
),
)
)
) );
$wp_customize->add_setting( 'post_featured_image',
array(
'default' => $this->defaults['post_featured_image'],
'transport' => 'refresh',
'sanitize_callback' => 'rttheme_switch_sanitization',
)
);
$wp_customize->add_control( new Customizer_Switch_Control( $wp_customize, 'post_featured_image',
array(
'label' => __( 'Show Featured Image', 'finbuzz' ),
'section' => 'single_post_secttings_section',
)
));
$wp_customize->add_setting( 'post_author_name',
array(
'default' => $this->defaults['post_author_name'],
'transport' => 'refresh',
'sanitize_callback' => 'rttheme_switch_sanitization',
)
);
$wp_customize->add_control( new Customizer_Switch_Control( $wp_customize, 'post_author_name',
array(
'label' => __( 'Show Author Name', 'finbuzz' ),
'section' => 'single_post_secttings_section',
)
));
$wp_customize->add_setting( 'post_date',
array(
'default' => $this->defaults['post_date'],
'transport' => 'refresh',
'sanitize_callback' => 'rttheme_switch_sanitization',
)
);
$wp_customize->add_control( new Customizer_Switch_Control( $wp_customize, 'post_date',
array(
'label' => __( 'Show Post Date', 'finbuzz' ),
'section' => 'single_post_secttings_section',
)
));
$wp_customize->add_setting( 'post_comment_num',
array(
'default' => $this->defaults['post_comment_num'],
'transport' => 'refresh',
'sanitize_callback' => 'rttheme_switch_sanitization',
)
);
$wp_customize->add_control( new Customizer_Switch_Control( $wp_customize, 'post_comment_num',
array(
'label' => __( 'Show Comment Number', 'finbuzz' ),
'section' => 'single_post_secttings_section',
)
));
$wp_customize->add_setting( 'post_cats',
array(
'default' => $this->defaults['post_cats'],
'transport' => 'refresh',
'sanitize_callback' => 'rttheme_switch_sanitization',
)
);
$wp_customize->add_control( new Customizer_Switch_Control( $wp_customize, 'post_cats',
array(
'label' => __( 'Show Category', 'finbuzz' ),
'section' => 'single_post_secttings_section',
)
));
$wp_customize->add_setting( 'post_tags',
array(
'default' => $this->defaults['post_tags'],
'transport' => 'refresh',
'sanitize_callback' => 'rttheme_switch_sanitization',
)
);
$wp_customize->add_control( new Customizer_Switch_Control( $wp_customize, 'post_tags',
array(
'label' => __( 'Show Tags', 'finbuzz' ),
'section' => 'single_post_secttings_section',
)
));
$wp_customize->add_setting( 'post_share',
array(
'default' => $this->defaults['post_share'],
'transport' => 'refresh',
'sanitize_callback' => 'rttheme_switch_sanitization',
)
);
$wp_customize->add_control( new Customizer_Switch_Control( $wp_customize, 'post_share',
array(
'label' => __( 'Show Share', 'finbuzz' ),
'section' => 'single_post_secttings_section',
)
));
$wp_customize->add_setting( 'post_links',
array(
'default' => $this->defaults['post_links'],
'transport' => 'refresh',
'sanitize_callback' => 'rttheme_switch_sanitization',
)
);
$wp_customize->add_control( new Customizer_Switch_Control( $wp_customize, 'post_links',
array(
'label' => __( 'Show Next / Previous post', 'finbuzz' ),
'section' => 'single_post_secttings_section',
)
));
$wp_customize->add_setting( 'post_author_bio',
array(
'default' => $this->defaults['post_author_bio'],
'transport' => 'refresh',
'sanitize_callback' => 'rttheme_switch_sanitization',
)
);
$wp_customize->add_control( new Customizer_Switch_Control( $wp_customize, 'post_author_bio',
array(
'label' => __( 'Show Author Bio', 'finbuzz' ),
'section' => 'single_post_secttings_section',
)
));
$wp_customize->add_setting( 'post_view',
array(
'default' => $this->defaults['post_view'],
'transport' => 'refresh',
'sanitize_callback' => 'rttheme_switch_sanitization',
)
);
$wp_customize->add_control( new Customizer_Switch_Control( $wp_customize, 'post_view',
array(
'label' => __( 'Show Views', 'finbuzz' ),
'section' => 'single_post_secttings_section',
)
));
$wp_customize->add_setting( 'post_length',
array(
'default' => $this->defaults['post_length'],
'transport' => 'refresh',
'sanitize_callback' => 'rttheme_switch_sanitization',
)
);
$wp_customize->add_control( new Customizer_Switch_Control( $wp_customize, 'post_length',
array(
'label' => __( 'Post Reading Length', 'finbuzz' ),
'section' => 'single_post_secttings_section',
)
));
// Related Post
$wp_customize->add_setting('post_related', array(
'default' => '',
'sanitize_callback' => 'esc_html',
));
$wp_customize->add_control(new Customizer_Heading_Control($wp_customize, 'post_related', array(
'label' => __( 'Related Post Settings', 'finbuzz' ),
'section' => 'single_post_secttings_section',
)));
$wp_customize->add_setting( 'show_related_post',
array(
'default' => $this->defaults['show_related_post'],
'transport' => 'refresh',
'sanitize_callback' => 'rttheme_switch_sanitization',
)
);
$wp_customize->add_control( new Customizer_Switch_Control( $wp_customize, 'show_related_post',
array(
'label' => __( 'Show Related Post', 'finbuzz' ),
'section' => 'single_post_secttings_section',
)
));
$wp_customize->add_setting( 'show_related_post_cat',
array(
'default' => $this->defaults['show_related_post_cat'],
'transport' => 'refresh',
'sanitize_callback' => 'rttheme_switch_sanitization',
)
);
$wp_customize->add_control( new Customizer_Switch_Control( $wp_customize, 'show_related_post_cat',
array(
'label' => __( 'Show Related Post Category', 'finbuzz' ),
'section' => 'single_post_secttings_section',
)
));
$wp_customize->add_setting( 'show_related_post_date',
array(
'default' => $this->defaults['show_related_post_date'],
'transport' => 'refresh',
'sanitize_callback' => 'rttheme_switch_sanitization',
)
);
$wp_customize->add_control( new Customizer_Switch_Control( $wp_customize, 'show_related_post_date',
array(
'label' => __( 'Show Related Post Date', 'finbuzz' ),
'section' => 'single_post_secttings_section',
)
));
$wp_customize->add_setting( 'show_related_post_number',
array(
'default' => $this->defaults['show_related_post_number'],
'transport' => 'refresh',
'sanitize_callback' => 'rttheme_text_sanitization',
)
);
$wp_customize->add_control( 'show_related_post_number',
array(
'label' => __( 'Show Related Post Number', 'finbuzz' ),
'section' => 'single_post_secttings_section',
'type' => 'number',
)
);
$wp_customize->add_setting( 'show_related_post_title_limit',
array(
'default' => $this->defaults['show_related_post_title_limit'],
'transport' => 'refresh',
'sanitize_callback' => 'rttheme_text_sanitization',
)
);
$wp_customize->add_control( 'show_related_post_title_limit',
array(
'label' => __( 'Show Related Post Title Length', 'finbuzz' ),
'section' => 'single_post_secttings_section',
'type' => 'number',
)
);
// Post Query
$wp_customize->add_setting( 'related_post_query',
array(
'default' => $this->defaults['related_post_query'],
'transport' => 'refresh',
'sanitize_callback' => 'rttheme_radio_sanitization',
)
);
$wp_customize->add_control( 'related_post_query',
array(
'label' => __( 'Query Type', 'finbuzz' ),
'section' => 'single_post_secttings_section',
'description' => esc_html__( 'Post Query', 'finbuzz' ),
'type' => 'select',
'choices' => array(
'cat' => esc_html__( 'Posts in the same Categories', 'finbuzz' ),
'tag' => esc_html__( 'Posts in the same Tags', 'finbuzz' ),
'author' => esc_html__( 'Posts by the same Author', 'finbuzz' ),
),
)
);
// Display post Order
$wp_customize->add_setting( 'related_post_sort',
array(
'default' => $this->defaults['related_post_sort'],
'transport' => 'refresh',
'sanitize_callback' => 'rttheme_radio_sanitization',
)
);
$wp_customize->add_control( 'related_post_sort',
array(
'label' => __( 'Sort Order', 'finbuzz' ),
'section' => 'single_post_secttings_section',
'description' => esc_html__( 'Display post Order', 'finbuzz' ),
'type' => 'select',
'choices' => array(
'recent' => esc_html__( 'Recent Posts', 'finbuzz' ),
'rand' => esc_html__( 'Random Posts', 'finbuzz' ),
'modified' => esc_html__( 'Last Modified Posts', 'finbuzz' ),
'popular' => esc_html__( 'Most Commented posts', 'finbuzz' ),
'views' => esc_html__( 'Most Viewed posts', 'finbuzz' ),
),
)
);
$wp_customize->add_setting( 'animation',
array(
'default' => $this->defaults['animation'],
'transport' => 'refresh',
'sanitize_callback' => 'rttheme_radio_sanitization',
)
);
$wp_customize->add_control( 'animation',
array(
'label' => __( 'Wow Animation', 'finbuzz' ),
'section' => 'single_post_secttings_section',
'description' => esc_html__( 'Wow Animation On/Off', 'finbuzz' ),
'type' => 'select',
'choices' => array(
'wow' => esc_html__( 'Animation On', 'finbuzz' ),
'No Wow' => esc_html__( 'Animation Off', 'finbuzz' ),
),
)
);
}
}
/**
* Initialise our Customizer settings only when they're required
*/
if ( class_exists( 'WP_Customize_Control' ) ) {
new FinbuzzTheme_Blog_Single_Post_Settings();
}