Does the functions.php file ever get called during an AJAX call? Debug AJAX

admin-ajax.php loads wp-load.php: /** Load WordPress Bootstrap */ require_once( dirname( dirname( __FILE__ ) ) . ‘/wp-load.php’ ); wp-load.php loads wp-config.php, and there wp-settings.php is loaded. And here we find this: // Load the functions for the active theme, for both parent and child theme if applicable. if ( ! defined( ‘WP_INSTALLING’ ) || ‘wp-activate.php’ === … Read more

What is the difference between front-page.php and home.php? [duplicate]

In short: index.php is a fallback template only, in case no appropriate template was found home.php is used for the blog (a listing of recent posts) front-page.php is used for the landing-page The universal index.php template The index.php template file is a fallback template. It is used as a last resort when no other more … Read more

How to display value of custom fields in page

Well, you are using: get_post_meta(get_the_ID(), ‘subtitle’, TRUE); So, you are saying to WordPress to get the meta value of the ‘subtitle’ field and that the returned value be in format of string. See get_post_meta() docu. To get all meta data of a post you should use get_post_custom() function instead. For example, if you are inside … Read more

How To extend WP_Customize_Control

Example and class for usage You can see on my current theme, how it’s possible to use this. Also you can usage the class. See this class on Github an check the functions.php for include this. Start & init You can register your custom settings for the theme customizer via the customize_register hook: add_action( ‘customize_register’, … Read more

WordPress Theme Preview Image

There is no automatic preview. You need to create the screenshot yourself and place it in the theme/child theme folder named screenshot.png The recommended image size (currently) is 1200px wide by 900px tall, however the screenshot will only be shown as 387×290. It is over-sized to allow for high-resolution viewing on HiDPI displays. Note that … Read more

Using wp_add_inline_style without a stylesheet

You just need to add the styles directly to the page head. The best way to do this is to use the ‘wp_head’ action hook, assuming you are using a theme that has the hook. Like so: add_action(‘wp_head’, ‘my_custom_styles’, 100); function my_custom_styles() { echo “<style>*{color: red}</style>”; } Check out the WP codex to learn more … Read more