Get all registered wp theme customizer sections?
Have you tried sections method? You can use $wp_customize->sections(). Example: foreach ($wp_customize->sections() as $section_key => $section_object ) { echo $section_key . ‘<br />’; }
Have you tried sections method? You can use $wp_customize->sections(). Example: foreach ($wp_customize->sections() as $section_key => $section_object ) { echo $section_key . ‘<br />’; }
What you are looking for here is already 80% available already, if you use the Customize Posts plugin and enable the Testimonials content type in Jetpack. Sections for testimonial posts can be listed in a Testimonials panel, in addition to a Select2 to jump to one: And then when expanding the testimonial section there are … Read more
Ok so you can check out my repo with some custom controls https://github.com/dingo-d/wordpress-theme-customizer-extra-custom-controls I’ve adapted the contextual controls by Weston Ruters guide here: https://make.xwp.co/2016/07/24/dependently-contextual-customizer-controls/ In my example in the repo I have the boxed body checkbox control that toggles boxed body. You’ll need to enqueue a script to put the js code in add_action( ‘customize_controls_enqueue_scripts’, … Read more
Your code is perfect just need to change ‘theme_mod’ instead of ‘option’ it will solve this. function themename_customize_register($wp_customize){ $wp_customize->add_setting( ‘test_setting’, array( ‘default’ => ‘value_xyz’, ‘capability’ => ‘edit_theme_options’, ‘type’ => ‘theme_mod’, )); $wp_customize->add_control( ‘test_control’, array( ‘label’ => __(‘Text Test’, ‘themename’), ‘section’ => ‘spacious_slider_number_section1’, ‘settings’ => ‘test_setting’, )); } add_action(‘customize_register’, ‘themename_customize_register’); And to retrieve it get_theme_mod( ‘test_setting’ … Read more
It’s an interesting thought to use the theme customizer to completely build the front page. Here is how I would start it. First, let’s build a section that only shows on the front-page: add_action( ‘customize_register’, ‘wpse_205445_customizer’ ); function wpse_205445_customizer($wp_customize) { $wp_customize->add_section( ‘custom-front-page’, array( ‘title’ => “Custom Front Page”, ‘priority’ => 10, ‘active_callback’ => ‘is_front_page’ )); … Read more
There’s very little documentation on this class, but here below is the full example from WordPress core (here’s github). Note you’d be using the $wp_customize object you get as argument to your custom_register callback and not $this as does the core class. I’ve done a search and replace below and it works. /* CORE COPY … Read more
You can use the input_attrs argument to pass attributes to the input: $wp_customize->add_control(‘directorist_address’, array( ‘label’ => __(‘Address’, ‘directorist’), ‘section’ => ‘directorist_contact’, ‘settings’ => ‘directorist_address’, ‘description’ => __(‘Enter your contact address. Eg. Abc Business Center, 123 Road, London, England’, ‘directorist’ ), ‘input_attrs’ => array( ‘placeholder’ => __( ‘Placeholder goes here…’, ‘directorist’ ), ) ) );
You could use active_callback property to delegate section visibility depending on current preview screen. $wp_customize->add_section( ‘my-section’, array( ‘title’ => __( ‘Section Title’ ), ‘active_callback’ => ‘is_shop’, ) ); Or custom $wp_customize->add_section( ‘my-section’, array( ‘title’ => __( ‘Section Title’ ), ‘active_callback’ => ‘is_custom_condition’, ) ); function is_custom_condition(){ $condition_is_met = //Some boolean returning logic; if( ! $condition_is_met … Read more
Use this JQuery for multiple image uploads: <!– js multi image –> jQuery(document).ready(function($) { // add image uploader functionality var meta_image_frame; $(‘.meta-image-button’).live(‘click’, function(e){ e.preventDefault(); if( meta_image_frame ){ wp.media.editor.open(); return; } meta_image_frame = wp.media.frames.file_frame = wp.media({ title: ‘Portfolio Image Gallery Selection Window’, button: {text: ‘Add to Gallery’}, library: { type: ‘image’}, multiple: false }); meta_image_frame.on(‘select’, function(){ … Read more
Visit this link and read about transporter argument: https://codex.wordpress.org/Theme_Customization_API Is that what you are looking for? Here is an example for you: <?php add_action( ‘customize_register’, ‘my_customizer’ ); function my_customizer($wp_customize){ $wp_customize->add_section( ‘my_section’, array( ‘title’ => __( ‘My Custom Section’, ‘mytheme’ ), //Visible title of section ‘capability’ => ‘edit_theme_options’, //Capability needed to tweak ) ); $wp_customize->add_setting( ‘my_setting’, … Read more