How to end this loop properly?

Let’s throw everything, but loop out: if ($my_query->have_posts()) { // open container around all posts while ($my_query->have_posts()) : $my_query->the_post(); // output for every post endwhile; // close containers around all posts } As you see: output of posts goes inside while loop as usual; opening larger containers is between checking if we have posts and … Read more

Loop custom post type by taxonomy (Category)

Before the loop starts use query_posts. Available parameters are here. Something like this: global $wp_query; query_posts( array( ‘post_type’ => ‘mycustomname’, ‘tax_query’ => array( ‘relation’ => ‘AND’, array( ‘taxonomy’ => ‘mytaxonomyname’, ‘field’ => ‘slug’, ‘terms’ => array( ‘myterm1slug’, ‘myterm2slug’ ) ) ) ) );

Display content from “About Us” page on the Home Page

If you’re using WP_Query, then assign that page a custom meta key ‘home_content’ with a value as 1. Then use WP_Query’s custom field parameters to loop over it. If you can restrict the title as ‘About’ everywhere, use get_page_by_title, and if you can restrict the slug as ‘about’, use get_page_by_path. These methods will work dynamically.