Add a dropdown to theme customizer

Add Section to Theme Customizer: $wp_customize->add_section( ‘parsmizban_options’, array( ‘title’ => __( ‘Theme Options’, ‘parsmizban’ ), //Visible title of section ‘priority’ => 20, //Determines what order this appears in ‘capability’ => ‘edit_theme_options’, //Capability needed to tweak ‘description’ => __(‘Allows you to customize settings for Theme.’, ‘parsmizban’), //Descriptive tooltip ) ); Add new Setting: $wp_customize->add_setting( ‘bootstrap_theme_name’, //No … Read more

Is it possible ( or advisable) to allow open access to the new theme customizer for potential clients?

Just an idea: Make a user called ‘Guest’ and look up the user ID When redirecting your potential clients to the admin page, redirect to a script that’s logging in your clients as the guest user (Code #1) Add an WordPress action to disallow the user when logged in as ‘Guest’ and not on customize.php … Read more

When cropping a header image, retain meta data (i.e. name, description, etc.) from original image?

Here’s one idea, that might need further testing: /** * Cropped header image with the same description/caption as the original image */ add_filter( ‘wp_create_file_in_uploads’, function( $cropped, $attachment_id ) { add_filter( ‘wp_insert_attachment_data’, function( $data ) use ( $attachment_id) { if( doing_action( ‘wp_ajax_custom-header-crop’ ) && is_array( $data ) ) { // Copy the original description to the … Read more

wp.customize.bind ready event not fired

Do not put the Customizer ready event handler inside of the jQuery event handler. The Customizer ready will trigger at jQuery ready, so you are adding the event handler too late. Just do: wp.customize.bind(‘ready’, function(){ console.log(‘ready’); }); Your JS needs to be enqueued with customize-controls script as its dependency. Enqueue at the customize_controls_enqueue_scripts action.

How to remove the Theme Customization Button from the dashboard and themes options page?

With the lastest version of WordPress (4.3) you can now natively remove the customizer’s theme switch setting without resorting to CSS hacks. /** * Remove customizer options. * * @since 1.0.0 * @param object $wp_customize */ function ja_remove_customizer_options( $wp_customize ) { //$wp_customize->remove_section( ‘static_front_page’ ); //$wp_customize->remove_section( ‘title_tagline’ ); //$wp_customize->remove_section( ‘nav’ ); $wp_customize->remove_section( ‘themes’ ); } add_action( … Read more

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