Custom Loops in WordPress
When researching how to use Gutenberg Ramp to partially allow Gutenberg on a WordPress site, I decided that I wanted to use a custom post type for the test so I wouldn't screw up the existing content for my blog. There is a problem with this idea. Custom post types don't appear in the default loop of a WordPress type so they wouldn't appear along with regular posts on the blog homepage. Most times, this is what we want. We want to use the custom post types on their own specialized loops. However, in this case, it is not what I want so I have to figure out a way to integrate posts and essays (the custom post type) in the same loop. The code below is a modified version of the experiment I ran on my development system. It is not complete, just enough to show the steps I took. ```php array( 'essay', 'post' ), ); // 1 // The Query $myQuery = new WP_Query( $args ); // 2 if ( $myQuery->have_posts() ) : // 3 if ( is_home() && ! is_front_page() ) : // 4 ?>