New customizer setting not showing value
New customizer setting not showing value
New customizer setting not showing value
You can access Customizer values with get_theme_mod(), so you just need to check the value of your setting before enqueueing stylesheets the normal way: function wpse_310123_enqueue_scheme_css() { $scheme = get_theme_mod( ‘theme_scheme’ ); if ( $scheme === ‘green’ ) { wp_enqueue_style( ‘theme-green’, get_theme_file_uri( ‘green.css’ ) ); } elseif ( $scheme === ‘blue’) { wp_enqueue_style( ‘theme-blue’, get_theme_file_uri( … Read more
The sanitize_callback method is not a place where the compile process should be happening, this is for sanitizing a control’s setting value being passed. Initially to accomplish this in BoldGrid Theme Framework, we used the leafo/scssphp library as well, but the lack of live previewing changes, and long wait times for simple changes like changing … Read more
You don’t have to export and import the tables from the database; you don’t have to build an export/import function for your theme either. There is an Export tool built in WordPress under the Tools menu and in the same sub-menu you’ll find the Import tool as well. The process is pretty straightforward: export the … Read more
How to check if customize previewer is refreshing?
You can see the customizer API to set default icon. This should do the trick, I guess: function mytheme_customize_register( $wp_customize ) { $wp_customize->add_setting( ‘site_icon’ , array( ‘default’ => get_bloginfo(‘template_url’) . ‘/images/logo.png’, ) ); } add_action( ‘customize_register’, ‘mytheme_customize_register’ );
How to extend nav-menu-item-control data in Appearance > Customize?
With @Otto’s tips, i found the problem. I was calling theme settings in functions.php and was calling settings as global variable in theme files. This was working properly except temporary changes was disappearing in theme customizer’s live edit when you change page with clicking links. After this experience, what i am suggesting: If you have … Read more
With your method it would be very tricky, if it’s possible at all. What you could do is use a custom header with flexible dimensions. That would allow the user to upload the header image and then crop it how ever they needed easily. // Register Theme Features function custom_theme_features() { // Add theme support … Read more
Create a /js subfolder in your theme directory, if such does not exist already. Save your script to a file in said folder. Then, in functions.php: if ( is_admin() ) { global $pagenow; if ( ‘customize.php’ === $pagenow ) { add_action( ‘admin_enqueue_scripts’, ‘wpse107236_enqueue_customizer_script’ ); } } function wpse107236_enqueue_customizer_script() { wp_enqueue_script( ‘your-script-handle’, get_template_directory_uri . ‘/js/your-script.js’, array( … Read more