400,
'arc_inner' => 400,
'fittext' => '',
'header_icon' => 'fa-heart',
'width' => '1170',
'layout' => 'right',
'primary' => 'col-md-8',
'display_author' => 'on',
'display_date' => 'on',
'display_comment_count' => 'on',
'display_categories' => 'on',
);
}
function bavotasan_theme_options() {
$bavotasan_default_theme_options = bavotasan_default_theme_options();
$return = array();
foreach( $bavotasan_default_theme_options as $option => $value ) {
$return[$option] = get_theme_mod( $option, $value );
}
return $return;
}
if ( class_exists( 'WP_Customize_Control' ) ) {
class Bavotasan_Textarea_Control extends WP_Customize_Control {
public $type = 'textarea';
public function render_content() {
?>
description ); ?>
choices ) )
return;
$name = '_customize-radio-' . $this->id;
?>
label ); ?>
choices as $value => $label ) :
?>
' . __( 'The sidebar will not appear on the Post Block page template.', 'arcade-basic' ) . '';
}
}
class Bavotasan_Customize_Section_Pro extends WP_Customize_Section {
public $type = 'premium-upgrade';
public $pro_url = '';
public function json() {
$json = parent::json();
$json['pro_url'] = esc_url( $this->pro_url );
return $json;
}
protected function render_template() { ?>
add_setting( 'arc', array(
'default' => $bavotasan_default_theme_options['arc'],
'sanitize_callback' => 'absint',
) );
$wp_customize->add_control( new Bavotasan_Text_Description_Control( $wp_customize, 'arc', array(
'label' => __( 'Arc Radius', 'arcade-basic' ),
'section' => 'title_tagline',
'priority' => 10,
) ) );
$wp_customize->add_setting( 'arc_inner', array(
'default' => $bavotasan_default_theme_options['arc_inner'],
'sanitize_callback' => 'absint',
) );
$wp_customize->add_control( new Bavotasan_Text_Description_Control( $wp_customize, 'arc_inner', array(
'label' => __( 'Arc Radius (Inner Pages)', 'arcade-basic' ),
'section' => 'title_tagline',
'description' => __( 'The space and rotation for each letter will be calculated using the arc radius and the width of the site title. Leave blank for no arc.', 'arcade-basic' ),
'priority' => 20,
) ) );
$wp_customize->add_setting( 'fittext', array(
'default' => $bavotasan_default_theme_options['fittext'],
'sanitize_callback' => array( $this, 'sanitize_checkbox' ),
) );
$wp_customize->add_control( 'fittext', array(
'label' => __( 'Use Fittext for long site title', 'arcade-basic' ),
'section' => 'title_tagline',
'type' => 'checkbox',
'priority' => 30,
) );
$wp_customize->add_setting( 'header_icon', array(
'default' => $bavotasan_default_theme_options['header_icon'],
'sanitize_callback' => 'esc_attr',
) );
$wp_customize->add_control( new Bavotasan_Icon_Select_Control( $wp_customize, 'header_icon', array(
'label' => __( 'Header Icon', 'arcade-basic' ),
'section' => 'title_tagline',
'priority' => 40,
) ) );
// Layout section panel
$wp_customize->add_section( 'bavotasan_layout', array(
'title' => __( 'Layout', 'arcade-basic' ),
'priority' => 35,
) );
$wp_customize->add_setting( 'width', array(
'default' => $bavotasan_default_theme_options['width'],
'sanitize_callback' => 'absint',
) );
$wp_customize->add_control( 'width', array(
'label' => __( 'Site Width', 'arcade-basic' ),
'section' => 'bavotasan_layout',
'priority' => 10,
'type' => 'select',
'choices' => array(
'1170' => __( '1200px', 'arcade-basic' ),
'992' => __( '992px', 'arcade-basic' ),
),
) );
$choices = array(
'col-md-2' => '17%',
'col-md-3' => '25%',
'col-md-4' => '34%',
'col-md-5' => '42%',
'col-md-6' => '50%',
'col-md-7' => '58%',
'col-md-8' => '66%',
'col-md-9' => '75%',
'col-md-10' => '83%',
);
$wp_customize->add_setting( 'primary', array(
'default' => $bavotasan_default_theme_options['primary'],
'sanitize_callback' => 'esc_attr',
) );
$wp_customize->add_control( 'primary', array(
'label' => __( 'Main Content Width', 'arcade-basic' ),
'section' => 'bavotasan_layout',
'priority' => 15,
'type' => 'select',
'choices' => $choices,
) );
$wp_customize->add_setting( 'layout', array(
'default' => $bavotasan_default_theme_options['layout'],
'sanitize_callback' => 'esc_attr',
) );
$layout_choices = array(
'left' => __( 'Left', 'arcade-basic' ),
'right' => __( 'Right', 'arcade-basic' ),
);
$wp_customize->add_control( new Bavotasan_Post_Layout_Control( $wp_customize, 'layout', array(
'label' => __( 'Sidebar Layout', 'arcade-basic' ),
'section' => 'bavotasan_layout',
'size' => false,
'priority' => 25,
'choices' => $layout_choices,
) ) );
$colors = array(
'default' => __( 'Default', 'arcade-basic' ),
'info' => __( 'Light Blue', 'arcade-basic' ),
'primary' => __( 'Blue', 'arcade-basic' ),
'danger' => __( 'Red', 'arcade-basic' ),
'warning' => __( 'Yellow', 'arcade-basic' ),
'success' => __( 'Green', 'arcade-basic' ),
);
// Posts panel
$wp_customize->add_section( 'bavotasan_posts', array(
'title' => __( 'Posts', 'arcade-basic' ),
'priority' => 45,
'description' => __( 'These options do not affect the Post Block page template.', 'arcade-basic' ),
) );
$wp_customize->add_setting( 'display_author', array(
'default' => $bavotasan_default_theme_options['display_author'],
'sanitize_callback' => array( $this, 'sanitize_checkbox' ),
) );
$wp_customize->add_control( 'display_author', array(
'label' => __( 'Display Author', 'arcade-basic' ),
'section' => 'bavotasan_posts',
'type' => 'checkbox',
'priority' => 10,
) );
$wp_customize->add_setting( 'display_date', array(
'default' => $bavotasan_default_theme_options['display_date'],
'sanitize_callback' => array( $this, 'sanitize_checkbox' ),
) );
$wp_customize->add_control( 'display_date', array(
'label' => __( 'Display Date', 'arcade-basic' ),
'section' => 'bavotasan_posts',
'type' => 'checkbox',
'priority' => 20,
) );
$wp_customize->add_setting( 'display_categories', array(
'default' => $bavotasan_default_theme_options['display_categories'],
'sanitize_callback' => array( $this, 'sanitize_checkbox' ),
) );
$wp_customize->add_control( 'display_categories', array(
'label' => __( 'Display Categories', 'arcade-basic' ),
'section' => 'bavotasan_posts',
'type' => 'checkbox',
'priority' => 30,
) );
$wp_customize->add_setting( 'display_comment_count', array(
'default' => $bavotasan_default_theme_options['display_comment_count'],
'sanitize_callback' => array( $this, 'sanitize_checkbox' ),
) );
$wp_customize->add_control( 'display_comment_count', array(
'label' => __( 'Display Comment Count', 'arcade-basic' ),
'section' => 'bavotasan_posts',
'type' => 'checkbox',
'priority' => 40,
) );
$wp_customize->register_section_type( 'Bavotasan_Customize_Section_Pro' );
$wp_customize->add_section(
new Bavotasan_Customize_Section_Pro ( $wp_customize, 'premium_upgrade', array(
'title' => esc_html__( 'Unlock Premium Theme Options', 'arcade-basic' ),
'pro_url' => 'https://themes.bavotasan.com/themes/arcade-wordpress-theme/',
'priority' => 999,
) )
);
}
/**
* Sanitize checkbox options
*
* @since 1.0.2
*/
public function sanitize_checkbox( $value ) {
if ( 'on' != $value )
$value = false;
return $value;
}
public function customize_controls_enqueue_scripts() {
wp_enqueue_script( 'bavotasan-customizer', BAVOTASAN_THEME_URL . '/library/js/admin/customizer.js', array( 'jquery' ), '', true );
wp_localize_script( 'bavotasan-customizer', 'Bavotasan_Customizer', array(
'upgradeAd' => __( 'Upgrade to premium version', 'arcade-basic' ),
));
wp_enqueue_style( 'bavotasan-customizer-styles', BAVOTASAN_THEME_URL . '/library/css/admin/customizer.css' );
}
}
$bavotasan_customizer = new Bavotasan_Customizer;