Manipulated offset and pagination, can’t display last post anymore
Manipulated offset and pagination, can’t display last post anymore
Manipulated offset and pagination, can’t display last post anymore
Is WP set to that -6 offset you need? In that case try date_i18n() to generate your date instead of date().
It’s a php error probably because its expecting either one of your if statements to be closed before the endwhile. It’s hard to tell without seeing all the code but at a guess check this one is closed: if ($tags) { also I would wrap your foreach in curly brackets. Maybe just preference though… foreach($tags … Read more
try: if(!is_paged()) { $post_offset = $blogpost_count; } else { $post_offset = (get_query_var(‘paged’)-1)*2+$blogpost_count; } … … ‘offset’ => $post_offset;
Neither of those are complete loops. That is, in both you have the start of an if but not the end of it, and the start of a while loop, but no the end of it. Also, you shouldn’t be using query_posts either, as it over writes the main query and is rarely the right … Read more
Yep – it is pretty inefficient. Here is a rewrite: <div id=”engagement”> <?php $images = new WP_Query( array( ‘post_parent’ => get_the_ID(), ‘post_status’ => ‘inherit’, ‘post_type’ => ‘attachment’, ‘post_mime_type’ => ‘image’, ‘order’ => ‘ASC’, ‘orderby’ => ‘menu_order ID’, ‘offset’ => 0, ‘posts_per_page’ => 6, // show six images total ‘update_post_term_cache’ => false, ) ); $count = … Read more
Fetch all five posts in one query, store the result in a variable and take one each time you want to show an advertisement. Now you cannot get duplicates, and more important: you save four queries.
I couldn’t understand your question. exactly Do you want next, prev post pagination? or You want to see next and prev posts titles or other content? Actually you placed an incorrect value to offset. You have to do something like this. // Initialize where to start the post from, 0 is most recent post $init_count … Read more
In your case, count would be offset + current_post: $my_query = new WP_Query( array( ‘post_type’ => ‘colors’, ‘posts_per_page’ => 5, ‘offset’ => 2 ) ); if ( $my_query->have_posts() ) : while ( $my_query->have_posts() ) : $my_query->the_post(); echo $my_query->query_vars[‘offset’] + $my_query->current_post; the_title(); endwhile; endif; wp_reset_postdata();
To have the pagination work properly you need to filter the posts at the WordPress main query level using the pre_get_posts action. By looking at your code, I don’t see where the post specific information is involved. Is $course_options holding information for the post?