remove_section( 'author_writer_topbar' );
$wp_customize->remove_setting( 'author_writer_sticky' );
$wp_customize->remove_control( 'author_writer_sticky' );
$wp_customize->remove_setting( 'author_writer_secondary_color_option' );
$wp_customize->remove_control( 'author_writer_secondary_color_option' );
$wp_customize->remove_setting( 'author_writer_slider_content_layout' );
$wp_customize->remove_control( 'author_writer_slider_content_layout' );
$wp_customize->remove_setting( 'author_writer_slide_btn_2' );
$wp_customize->remove_control( 'author_writer_slide_btn_2' );
}
add_action( 'customize_register', 'bookstore_library_remove_customize_register', 11 );
if ( ! defined( 'BOOKSTORE_LIBRARY_TEXT' ) ) {
define( 'BOOKSTORE_LIBRARY_TEXT', __( 'Bookstore Library Pro','bookstore-library' ));
}
if ( ! defined( 'BOOKSTORE_LIBRARY_BUY_TEXT' ) ) {
define( 'BOOKSTORE_LIBRARY_BUY_TEXT', __( 'Upgrade Pro','bookstore-library' ));
}
add_action( 'customize_register', function( $manager ) {
// Load custom sections.
load_template( trailingslashit( get_template_directory() ) . '/inc/section-pro.php' );
$manager->register_section_type( Author_Writer_Button::class );
$manager->add_section(
new Author_Writer_Button( $manager, 'author_writer_pro', [
'title' => esc_html( BOOKSTORE_LIBRARY_TEXT,'bookstore-library' ),
'priority' => 0,
'button_text' => __( 'GET PREMIUM', 'bookstore-library' ),
'button_url' => esc_url( AUTHOR_WRITER_PRO_THEME_URL )
] )
);
} );
function bookstore_library_customize_register( $wp_customize ) {
// Register the custom control type.
$wp_customize->register_control_type( 'Bookstore_Library_Toggle_Control' );
// Pro Version
class Bookstore_Library_Customize_Pro_Version extends WP_Customize_Control {
public $type = 'pro_options';
public function render_content() {
echo 'Unlock Premium '. esc_html( $this->label ) .'? ';
echo '';
echo '';
echo ' '. esc_html( BOOKSTORE_LIBRARY_BUY_TEXT,'bookstore-library' ) .'';
echo '';
}
}
// Custom Controls
function bookstore_library_sanitize_custom_control( $input ) {
return $input;
}
$wp_customize->add_section( 'bookstore_library_workshop_section' , array(
'title' => __( 'Latest Event Settings', 'bookstore-library' ),
'panel' => 'author_writer_panel_id',
'priority' => 4,
) );
$wp_customize->add_setting( 'bookstore_library_workshop_show_hide', array(
'default' => true,
'transport' => 'refresh',
'sanitize_callback' => 'author_writer_sanitize_checkbox',
) );
$wp_customize->add_control( new Bookstore_Library_Toggle_Control( $wp_customize, 'bookstore_library_workshop_show_hide', array(
'label' => esc_html__( 'Show / Hide section', 'bookstore-library' ),
'section' => 'bookstore_library_workshop_section',
'type' => 'toggle',
'settings' => 'bookstore_library_workshop_show_hide',
) ) );
$wp_customize->add_setting('bookstore_library_workshop_section_short_tittle',array(
'default' => '',
'sanitize_callback' => 'sanitize_text_field'
));
$wp_customize->add_control('bookstore_library_workshop_section_short_tittle',array(
'label' => __('Section Short Title','bookstore-library'),
'section' => 'bookstore_library_workshop_section',
'type' => 'text'
));
$wp_customize->selective_refresh->add_partial( 'bookstore_library_workshop_section_short_tittle', array(
'selector' => 'h6.title-p',
'render_callback' => 'author_writer_customize_partial_bookstore_library_workshop_section_short_tittle',
));
$wp_customize->add_setting('bookstore_library_workshop_section_tittle',array(
'default' => '',
'sanitize_callback' => 'sanitize_text_field'
));
$wp_customize->add_control('bookstore_library_workshop_section_tittle',array(
'label' => __('Section Title','bookstore-library'),
'section' => 'bookstore_library_workshop_section',
'type' => 'text'
));
$categories = get_categories();
$cats = array();
$i = 0;
$offer_cat[]= 'select';
foreach($categories as $category){
if($i==0){
$default = $category->slug;
$i++;
}
$offer_cat[$category->slug] = $category->name;
}
$wp_customize->add_setting('bookstore_library_workshop_section_category',array(
'default' => 'select',
'sanitize_callback' => 'author_writer_sanitize_choices',
));
$wp_customize->add_control('bookstore_library_workshop_section_category',array(
'type' => 'select',
'choices' => $offer_cat,
'label' => __('Select Category','bookstore-library'),
'section' => 'bookstore_library_workshop_section',
));
$wp_customize->add_setting( 'bookstore_library_remove_date', array(
'default' => true,
'transport' => 'refresh',
'sanitize_callback' => 'author_writer_sanitize_checkbox',
) );
$wp_customize->add_control( new Bookstore_Library_Toggle_Control( $wp_customize, 'bookstore_library_remove_date', array(
'label' => esc_html__( 'Show / Hide Date', 'bookstore-library' ),
'section' => 'bookstore_library_workshop_section',
'type' => 'toggle',
'settings' => 'bookstore_library_remove_date',
) ) );
$wp_customize->add_setting( 'bookstore_library_remove_time', array(
'default' => true,
'transport' => 'refresh',
'sanitize_callback' => 'author_writer_sanitize_checkbox',
) );
$wp_customize->add_control( new Bookstore_Library_Toggle_Control( $wp_customize, 'bookstore_library_remove_time', array(
'label' => esc_html__( 'Show / Hide Time', 'bookstore-library' ),
'section' => 'bookstore_library_workshop_section',
'type' => 'toggle',
'settings' => 'bookstore_library_remove_time',
) ) );
// Pro Version
$wp_customize->add_setting( 'bookstore_library_services_pro_version_logo', array(
'sanitize_callback' => 'bookstore_library_sanitize_custom_control'
));
$wp_customize->add_control( new Bookstore_Library_Customize_Pro_Version ( $wp_customize,'bookstore_library_services_pro_version_logo', array(
'section' => 'bookstore_library_workshop_section',
'type' => 'pro_options',
'label' => esc_html__( 'Features ', 'bookstore-library' ),
'description' => esc_url( AUTHOR_WRITER_PRO_THEME_URL ),
'priority' => 10,
)));
}
add_action( 'customize_register', 'bookstore_library_customize_register' );