WP_Filesystem in custom customize control

To cache something you can use the Transients API (thanks @Otto), get_transient() to see if it exists already exists, if not then fetch the data and store it in a transient with set_transient(). if (get_transient(‘mytheme_webfonts’)) { $content = get_transient(‘mytheme_webfonts’); } else{ $googleApi = ‘https://www.googleapis.com/webfonts/v1/webfonts?sort=alpha&key={API_KEY}’; $fontContent = wp_remote_get( $googleApi, array(‘sslverify’ => false) ); $content = json_decode($fontContent[‘body’]); … Read more

How to import and export settings from live customizer?

I recently built this for one of my themes… Export: https://github.com/wpmu/maera/blob/7492f7b90544c792a3eb752d8552674882e1c1cd/lib/admin-page.php#L105-L117 Import: https://github.com/wpmu/maera/blob/7492f7b90544c792a3eb752d8552674882e1c1cd/lib/admin-page.php#L124 That file actually contains an entire admin page with the export data and import textarea so you could simply get that and modify it to suit your own needs. I hope that helps!

Customizer API – Class doesn’t exist error

I’m not sure if there are different approaches for this, but this is a pattern I’ve implemented successfully in several places. In my approach, I am including the “add_control” inside the function that contains the custom class. The $wp_customize object gets passed in to the main function. Also, I’m not sure why you are trying … Read more

Problem in using Customizer

Hey Only Change the code like this function cult_customizer_register( $wp_customize ) { $wp_customize->add_section( ‘cult_topic_thumb’ , array( ‘title’ => __( ‘Topic of the Week’ ), ‘priority’ => 36, ‘description’ => ‘Allows you to upload an image for your topic of the week section.’, ) ); $wp_customize->add_setting( ‘display_topic_thumb’ ); $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, ‘display_topic_thumb’, array( ‘label’ => … Read more

Theme Customization API Changes not Saving

Well, first problem: $wp_customize->add_setting( ‘tcx_footer_copyright_text’, … echo get_theme_mod( ‘tcx_footer_copyright_message’ ); Those aren’t the same setting names. Note sure why you don’t see the default value in the input field, as there’s nothing wrong there. Although you should also define the same default in the second parameter of the get_theme_mod() call.

Custom JS text area in customizer is being formatted wrong in document

@sam-skirrow just posting here what we did to fix this… WordPress 4.1 requires us to use a sanitize_callback filter when creating settings for the customizer (with good reason). Since you’re using the kirki framework to create these customizer settings, kirki detects that this is a textarea field and so it automatically applies the esc_textarea filter. … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)