Shortcode and get_template_part

Function get_template_part() load file only from theme directory (or child theme). There is no filter or action hook that would change this behavior. You will need to write your own get_template_part() variant to load files from the plugin directory (replace the locate_template() call from the original function). Or write an explicit: $query->the_post(); include plugin_dir_path( __FILE__ … Read more

Blog template with different header to rest of site

Try this: if ( !is_home() && !is_cart() && !is_checkout() && !is_account_page() ) : if ( is_page( ‘contact-us’ ) ): get_template_part( ‘template-parts/header/header’, ‘map’ ); else: get_template_part( ‘template-parts/header/header’, ‘slider’ ); endif; endif; is_home() will return true if the current page/query is for the blog homepage, otherwise it returns false. You can read up about is_home() on the … Read more

Adding a second loop breaks everything

The root problem here is a missing endif; on the second loop. But, there are a few changes we can make to improve this and make things work, this loop, will work a lot better: <h3>Other standards</h3> <div class=”row”> <div class=”col-12″> <?php $query = new WP_Query( [ ‘post_type’ => ‘page’, ‘post_parent’ => 27, ‘posts_per_page’ => … Read more