How to add field customizable by the theme editor to your theme?
Theme Customization API on WordPress Codex: https://codex.wordpress.org/Theme_Customization_API
Theme Customization API on WordPress Codex: https://codex.wordpress.org/Theme_Customization_API
After adding your custom control class, you need to register your control like below code, then you can call your control via JS function prefix_customize_register( $wp_customize ) { $wp_customize->register_control_type( ‘TestControl’ ); } add_action( ‘customize_register’, ‘prefix_customize_register’ ); Then via JS, like this: api.control.add( new api.Control( ‘birthdate’, { type: ‘test-control’, label: ‘Birthdate’, description: “Someone was born on … Read more
You want to use the do_shortcode() function which allows the execution of shortcodes the same way that they run when used in the standard content areas. <?php echo do_shortcode( ‘[WP-Coder id=”4″]’ ); ?> If you need to get more complex you can read all about it here.
I think you might be looking for something like this: add_theme_support( ‘custom-logo’, array( ‘height’ => 480, ‘width’ => 720, ) ); You could also go with: add_theme_support( ‘custom-header’, array( ‘height’ => 480, ‘width’ => 720, ) ); Use the custom-header for the top logo and the custom-logo for the footer (or the other way round). … Read more
I was actually able to get this to work with the help of kind developers on the WordPress.org forum, and I will post the answer to my question here to benefit anyone who has the same problem. It is best to use the WP core functionality if it exists, which is the case for color … Read more
I think what your issue may be is that you aren’t setting the priority of the sections after you manually change their order in the DOM, so once the controls UI reflows the manual change may be getting lost. Your code can be simplified as well by not having to register hidden section or control. … Read more
Thanks to @chip_bennett to point it out! I registered the settings using settings api and I was trying to add the settings on customize api by the type of theme_mod that’s why it was showing the error. After changing the ‘type’ => ‘theme_mod’ to ‘type’ => ‘option’, it worked 🙂
Assuming that you mean that students is a table within your WP database, this should get you started. I’d recommend a read of the following materials, which are pretty useful – WordPress Codex for $wpdb. WordPress Codex for Theme Customization API. Here is the code to add the dorpdown box – /** Required to make … Read more
I was able to solve this. Here is the code that got the checkbox working. function theme_customizer_register_checkbox($wp_customize) { $wp_customize->add_section( ‘global_options’, array( ‘title’ => ‘Global Options’, ) ); $wp_customize->add_setting( ‘show_supporters’, array( ‘default’ => true, ‘transport’ => ‘postMessage’ ) ); $wp_customize->add_control( ‘show_supporters’, array( ‘section’ => ‘global_options’, ‘label’ => ‘Show supporters section?’, ‘type’ => ‘checkbox’ ) ); } … Read more
If you need a specific ordering of the input fields, then add “priority” values to the controls in the add_control calls, same as you already have for the sections. If you don’t have a priority, then no particular order is guaranteed and you get whatever PHP happens to order your arrays as.