WordPress sorting posts by date and title using a dropdown

Here I put orderby attributes as option values – date and title. <form method=”GET”> <select name=”orderby” id=”orderby”> <option value=”date”>Newest to Oldest</option> <option value=”title”>Alphabetical</option> <button type=”submit”>Apply</button> <form> On the same page you can recieve select value and set as orderby attribute $wpb_all_query = new WP_Query(array( ‘post_type’=>’post’, ‘posts_per_page’=>-1, ‘order’=>’ASC’, ‘orderby’=> esc_attr($_GET[‘orderby’]) ); Use your loop to show … Read more

Show posts from two specific category in WP_Query

So you want to show only posts that have both employee and full-time categories. If that is the case than you can do the following. Because you haven’t posted the full query args I will only show the tax_query part ‘tax_query’ => array( ‘relation’ => ‘AND’, array( ‘taxonomy’ => ‘category’, ‘field’ => ‘slug’, ‘terms’ => … Read more