Can I decide what categories show on my posts page?

$args = array( //post basics ‘post_status’ => ‘publish’, ‘post_type’ => ‘post’, ‘posts_per_page’ => 10 //order ‘orderby’ => ‘date’, ‘order’ => ‘desc’, //category query ‘tax_query’ => array( array( ‘taxonomy’ => ‘category’, ‘field’ => ‘slug’, ‘terms’ => ‘news’ //make this the slug of the category you want to use ) ) ); $posts = new WP_Query( $args … Read more

Getting the list of the latests posts and custom type posts in the homepage

The post_type argument of the get_posts() function is for retrieving different types of post content. I’m assuming here that ‘work’, ‘photo’, and ‘code’ are custom post types. Grabbing multiple post types with WP_Query Instead of using get_posts(), you can use the WP_Query class to grab multiple post types. I just tested the following on my … Read more