How to properly delete and rename the custom settings/section/control in theme customizer?

You have the value stored in the database in the cta_settings theme mod. If you want to rename your setting, then you’ll need to move the theme mod data you have stored in the database. For example: if ( get_theme_mod( ‘cta_settings’ ) ) { set_theme_mod( ‘phone_settings’, get_theme_mod( ‘cta_settings’ ) ); remove_theme_mod( ‘cta_settings’ ); }

Don’t print customizer styles when no setting has been used

There’s not really any trick, you need to check all the values. You can save a little space though, by omitting the != ”, which is redundant: if ( get_theme_mod( ‘myplugin_h2_color’ ) || get_theme_mod( ‘myplugin_h3_color’ ) || get_theme_mod( ‘myplugin_p_color’ ) || get_theme_mod( ‘myplugin_p_size’ ) ) { However, it’s possible to save Customiser settings into a … Read more

Using get_theme_mod in php ajax form doesn’t work

You should never access directly theme files, form submissions, ajax, and even just get requests will be blocked at the server level by some security hardening measure. Ignoring that for a moment, the reason your code fails is because wordpress wasn’t bootstrapped and therefor there are no core functions available. It is actually not 100% … Read more

Theme logo metadata into template file

Ends up that “alt” is not stored in wp_get_attachment_metadata so I pulled it from the post meta: $custom_logo_id = get_theme_mod(‘custom_logo’); if ($custom_logo_id) { $image = wp_get_attachment_image_src($custom_logo_id, ‘full’); $meta = wp_get_attachment_metadata($custom_logo_id); **$alt_text = get_post_meta($custom_logo_id, ‘_wp_attachment_image_alt’, true);** echo ‘<img src=”‘ . $image[0] . ‘” alt=”‘ . $alt_text . ‘” width=”‘ . $meta[‘width’] . ‘” height=”‘ . $meta[‘height’] … Read more

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