Initialize WordPress customizer variables

I believe that all you need to do is pass defaults to get_option function init_theme_options() { // check to see if theme options are set // Not sure how your options are organized but… $defaults = array( ‘opt1’ => ‘stuff1’, ‘opt2’ => ‘stuff2’ ) $theme_options = get_option(‘theme_option_name’,$defaults); } If you want to see a very … Read more

WP 3.8 theme customizer error

I think your way of enqueueing is wrong here. When you use wp_register_script, you only need to pass the handle to wp_enqueue_script. Try updating your function to: function customizer_preview() { wp_enqueue_script( ‘wproto-customizer-preview’, get_template_directory_uri() . ‘/js/admin/screen-customizer.js’, array( ‘jquery’, ‘customize-preview’ ) ); }

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

where to change text for header?

You can use twentyfifteen_custom_header_args filter for customizing width and height. Check following example. add_filter( ‘twentyfifteen_custom_header_args’, ‘theme_slug_custom_header_args’ ); function theme_slug_custom_header_args( $args ){ $args[‘width’] = 600; $args[‘height’] = 800; return $args; } In the example, width is changed to 600 and height is set to 800.

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