Custom Post Type single.php template only shows the latest post

You shouldn’t be using custom queries in these templates. The main query (using have_posts();, the_post(); etc. without $loop) is already set up with the correct posts for these templates. Look at the custom query you’re using on the single template: $args = array(‘post_type’ => ‘journal’, ‘showposts’ => 1, ‘post_status’ => ‘publish’, ‘orderby’ => ‘date’, ‘order’ … Read more

Changing the_posts_navigation() html output

This function use the get_the_posts_navigation() to change the text Older posts and Newer posts you can pass array with the args. See this example with the default values: the_posts_navigation( array( ‘prev_text’ => __(‘Older posts’, ‘theme_textdomain’), ‘next_text’ => __(‘Newer posts’, ‘theme_textdomain’), ‘screen_reader_text’ => __(‘Posts navigation’, ‘theme_textdomain’) ) );

List posts that don’t have a specific tag?

I believe you can filter them out in your original WP_Query using Taxonomy Parameters. Then you can delete the for loop altogether. $args = array( ‘post_type’ => ‘post’, ‘posts_per_page’ =>-1, ‘tax_query’ => array( array( ‘taxonomy’ => ‘post_tag’, ‘field’ => ‘slug’, ‘terms’ => array(‘fun’,’learning’), ‘operator’ => ‘NOT IN’, ), ), ); $wpb_all_query = new WP_Query( $args … Read more

How to get The Loop working with $wpdb->get_results()

Turns out I didn’t follow the instructions in the manual to the letter: I seem to have declared global $post too early. I don’t entirely see through this but it works fine now using this code: $eventsPosts = $wpdb->get_results($querystr, OBJECT); if ($eventsPosts) { global $post; foreach ($eventsPosts as $post) { setup_postdata($post); the_title(); // or whatever … Read more

WordPress: Loop Help

You’re using query_posts() for your featured-post custom loop. As the Codex says: don’t do that. The query_posts() function is intended to modify the Primary Loop. If you need a custom loop, use e.g. $my_custom_query = new WP_Query( $args ). See here for a good break-down of custom-loop options.