Dynamically change feature image in customiser

The customizer has a special control for file uploads. Assuming that you already know how the theme customizer works, you would have to add four controls in this fashion: $wp_customize->add_control( new WP_Customize_Upload_Control( $wp_customize, ‘wpse215632_image_1’, array( ‘label’ => __( ‘First image’, ‘wpse215632_theme’ ), ‘description’ => __( ‘More about first image’, ‘wpse215632_theme’ ), ‘section’ => ‘wpse215632__section_id’, ‘settings’ … Read more

Add meta-information to theme itself

It is not possible to extend the default headers used by WP_Theme: private static $file_headers = array( ‘Name’ => ‘Theme Name’, ‘ThemeURI’ => ‘Theme URI’, ‘Description’ => ‘Description’, ‘Author’ => ‘Author’, ‘AuthorURI’ => ‘Author URI’, ‘Version’ => ‘Version’, ‘Template’ => ‘Template’, ‘Status’ => ‘Status’, ‘Tags’ => ‘Tags’, ‘TextDomain’ => ‘Text Domain’, ‘DomainPath’ => ‘Domain Path’, … Read more

How to use the responsive images feature from WP 4.4 in your themes

Following our exchange in the comments I’ve reread your question and have a pretty straightforward answer: It looks like it’s working fine. You are worried about the sizes attribute in your second example, but it’s the srcset attribute that you should look at and it is showing all of your image sizes: <img src=”http://xxx.dev/wp-content/uploads/Delft_IMG_6275-e1453192498922.jpg” class=”attachment-full … Read more

WordPress Customize — Move “menus” options / field to another section

The customizer is divided into panels, then sections, then controls. You cannot move a panel inside another panel. However, you can move sections from one panel to another. In this case you can move the sections inside “Menus” to the “Header panel” like this: $wp_customize->get_section (‘AAA’)->panel=”BBB”; Where AAA is the slug of the section you … Read more

Identifying the priority of style.css so I can make a small CSS file load last

When you properly enqueue a file, an instance of the wp_styles (more on this) class is created. The priority of actions is ignored. So it doesn’t matter if you write anything like add_action (‘wp_enqueue_scripts’,’function_adding_main_style’,10); add_action (‘wp_enqueue_scripts’,’function_adding_small_style’,11); The reason is exactly the existence of the dependency system. WP first collects all enqueued style files and then … Read more