Created
April 10, 2020 07:33
-
-
Save alokstha1/a64d28466f1b86c71f0958ff5714ba45 to your computer and use it in GitHub Desktop.
Register wp customizer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function cpm_cc_customize_register( $wp_customize ) { | |
$wp_customize->add_panel('cpm_cc_option_panel', array( | |
'capability' => 'edit_theme_options', | |
'theme_supports' => '', | |
'title' => __('CC Options'), | |
'description' => __('Panel to update theme options'), // Include html tags such as <p>. | |
'priority' => 10 // Mixed with top-level-section hierarchy. | |
) | |
); | |
$wp_customize->add_section( 'cpm_cc_product_section', array( | |
'title' => __( 'Product Order' ), | |
'description' => __('Section for Product Order Setting' ), | |
'panel' => 'cpm_cc_option_panel', | |
'priority' => 32, | |
) | |
); | |
$wp_customize->add_setting( 'cpm_cc_product_count', array( | |
'default' => '5', | |
'capability' => 'edit_theme_options', | |
) | |
); | |
$wp_customize->add_control( 'cpm_cc_product_count', array( | |
'label' => __( 'No. of products' ), | |
'section' => 'cpm_cc_product_section', | |
'description' => __('Enter the no. of products to display'), | |
'type' => 'text', | |
'priority' => 1, | |
) | |
); | |
$wp_customize->add_setting( 'cpm_cc_product_orderby', array( | |
'default' => 'date', | |
) | |
); | |
$wp_customize->add_control( | |
'cpm_cc_product_orderby', | |
array( | |
'type' => 'select', | |
'label' => 'Order By', | |
'priority' => 2, | |
'section' => 'cpm_cc_product_section', | |
'choices' => array( | |
'ID' => 'ID', | |
'title' => 'Title', | |
'name' => 'Name', | |
'date' => 'Date', | |
), | |
) | |
); | |
$wp_customize->add_setting( 'cpm_cc_product_order', array( | |
'default' => 'DESC', | |
) | |
); | |
$wp_customize->add_control( | |
'cpm_cc_product_order', | |
array( | |
'type' => 'select', | |
'label' => 'Order', | |
'priority' => 3, | |
'section' => 'cpm_cc_product_section', | |
'choices' => array( | |
'ASC' => 'ASC', | |
'DESC' => 'DESC', | |
), | |
) | |
); | |
$wp_customize->add_section( 'cpm_cc_w_n_o_section', array( | |
'title' => __( 'Works Well & Other Product Settings' ), | |
'description' => __('Product Order Setting in Works well with and Other products section.' ), | |
'panel' => 'cpm_cc_option_panel', | |
'priority' => 32, | |
) | |
); | |
$wp_customize->add_setting( 'cpm_cc_works_n_other_product_count', array( | |
'default' => '6', | |
'capability' => 'edit_theme_options', | |
) | |
); | |
$wp_customize->add_control( 'cpm_cc_works_n_other_product_count', array( | |
'label' => __( 'No. of products' ), | |
'section' => 'cpm_cc_w_n_o_section', | |
'description' => __('Enter the no. of products to display in Works Well With and Other Product You Mignt Like'), | |
'type' => 'text', | |
'priority' => 1, | |
) | |
); | |
$wp_customize->add_section( 'cpm_cc_product_guide_steps', array( | |
'title' => __( 'Product Guide' ), | |
'description' => __('Set the contents for Product Guide Steps.' ), | |
'panel' => 'cpm_cc_option_panel', | |
'priority' => 33, | |
) | |
); | |
$wp_customize->add_setting( 'cpm_cc_rent_image', array( | |
'capability' => 'edit_theme_options', | |
) ); | |
$wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'cpm_cc_rent_image', array( | |
'label' => __( 'Rent Image' ), | |
'section' => 'cpm_cc_product_guide_steps', | |
) | |
) | |
); | |
$wp_customize->add_setting( 'cpm_cc_rent_textarea', array( | |
'capability' => 'edit_theme_options', | |
) ); | |
$wp_customize->add_control( 'cpm_cc_rent_textarea', array( | |
'label' => __( 'Rent Description' ), | |
'type' => 'textarea', | |
'section' => 'cpm_cc_product_guide_steps', | |
) ); | |
$wp_customize->add_setting( 'cpm_cc_sell_image', array( | |
'capability' => 'edit_theme_options', | |
) ); | |
$wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'cpm_cc_sell_image', array( | |
'label' => __( 'Sell Image' ), | |
'section' => 'cpm_cc_product_guide_steps', | |
) | |
) | |
); | |
$wp_customize->add_setting( 'cpm_cc_sell_textarea', array( | |
'capability' => 'edit_theme_options', | |
) ); | |
$wp_customize->add_control( 'cpm_cc_sell_textarea', array( | |
'label' => __( 'Sell Description' ), | |
'type' => 'textarea', | |
'section' => 'cpm_cc_product_guide_steps', | |
) ); | |
$wp_customize->add_setting( 'cpm_cc_keep_image', array( | |
'capability' => 'edit_theme_options', | |
) ); | |
$wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'cpm_cc_keep_image', array( | |
'label' => __( 'Keep Image' ), | |
'section' => 'cpm_cc_product_guide_steps', | |
) | |
) | |
); | |
$wp_customize->add_setting( 'cpm_cc_keep_textarea', array( | |
'capability' => 'edit_theme_options', | |
) ); | |
$wp_customize->add_control( 'cpm_cc_keep_textarea', array( | |
'label' => __( 'Keep Description' ), | |
'type' => 'textarea', | |
'section' => 'cpm_cc_product_guide_steps', | |
) ); | |
/*Mailchimp subscribe credentials*/ | |
$wp_customize->add_panel('cpm_mailchimp_panel', array( | |
'capability' => 'edit_theme_options', | |
'theme_supports' => '', | |
'title' => __('Mailchimp Options'), | |
'description' => __('Panel to add mailchimp API key, list id'), // Include html tags such as <p>. | |
'priority' => 10 // Mixed with top-level-section hierarchy. | |
) | |
); | |
$wp_customize->add_section( 'cpm_mailchimp_section', array( | |
'title' => __( 'Mailchimp Option' ), | |
'description' => __('Add Mailchimp Details' ), | |
'panel' => 'cpm_mailchimp_panel', | |
'priority' => 32, | |
) | |
); | |
//Mailchimp Api Key | |
$wp_customize->add_setting( 'cpm_mailchimp_api_key', array( | |
'default' => '', | |
'capability' => 'edit_theme_options', | |
) | |
); | |
$wp_customize->add_control( 'cpm_mailchimp_api_key', array( | |
'label' => __( 'Mailchimp Api Key' ), | |
'section' => 'cpm_mailchimp_section', | |
'description' => __('Enter the mailchimp api key generated'), | |
'type' => 'text', | |
'priority' => 1, | |
) | |
); | |
//Mailchimp List Id | |
$wp_customize->add_setting( 'cpm_mailchimp_list_id', array( | |
'default' => '', | |
'capability' => 'edit_theme_options', | |
) | |
); | |
$wp_customize->add_control( 'cpm_mailchimp_list_id', array( | |
'label' => __( 'Mailchimp List Id' ), | |
'section' => 'cpm_mailchimp_section', | |
'description' => __('Enter the mailchimp list id'), | |
'type' => 'text', | |
'priority' => 2, | |
) | |
); | |
} | |
add_action( 'customize_register', 'cpm_cc_customize_register' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment