Custom Theme functions.php – Using add_settings_field and input type=”file” to set custom logo

The examples you’ve seen are out of date. From WordPress 4.5, released in 2016, the proper way to support a custom logo was to register support for the Custom Logo feature in your theme. That link has the full documentation, but the short version is that you use this code to enable the standard logo … Read more

Echo Category In Loop

The function get_theme_mod() returns information. Since you want to assign it and not echo it to the screen, we can remove the echo and PHP tags: $args = array( ‘post_type’ => ‘product’, ‘stock’ => 1, ‘posts_per_page’ => 4, ‘product_cat’ => get_theme_mod( ‘vatname’, ‘Clothing’ ), ‘orderby’ =>’date’, ‘order’ => ‘ASC’ ); That should fix your query. … Read more

Access preview settings in php

It seems that the problem was that I was adding the function to ‘init’ and where the preview was not updated. Adding it to wp_enqueue_script solved my issue. Changed add_action(‘init’, ‘autoCompileLess’); to add_action(‘wp_enqueue_scripts’, ‘autoCompileLess’);

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’ ); }