Nav menus Fast previewing not working with wp_get_nav_menu_items!

You must use wp_nav_menu() if you want to get selective refresh (fast previewing). If you want to have a custom nav menu that uses selective refresh, then instead of manually iterating over wp_get_nav_menu_items() you instead need to subclass the Walker_Nav_Menu to implement your custom logic, and then pass it into wp_nav_menu() like this: wp_nav_menu( array( … Read more

Responsive Images with art direction

The ‘picture’ element supports min-width and max-width. If the image is a featured image then wp_get_attachment_image_src is what you would use: // open the picture element <picture> // use this image if the width of a screen does not go over 599px <source srcset=”https://wordpress.stackexchange.com/https://wordpress.stackexchange.com/https://wordpress.stackexchange.com/<?php echo wp_get_attachment_image_src( get_post_thumbnail_id(), ‘whatever add_image_size you want to use’, false )[0] … Read more

Import settings from another theme

Well, you can read the core code to find the actions, or you can use a debugging method to find the one you need. Put into wp-config.php: define(‘WP_DEBUG’, true); define( ‘WP_DEBUG_LOG’, true ); Then make a mu-plugin file containing: <?php add_action( ‘all’, ‘_action_printer’ ); function _action_printer( $a ){ if (strpos(‘gettext’, $a) === false && strpos(‘escape’, … Read more