Tag Info

New answers tagged

2

What you are experiencing is quite normal and expected. This is one of the big reasons I always hammer on this point, never use custom queries to replace the main query on the home page or any type of archive page. They solve one issue but creates plenty other new ones Lets look at what you have and why you are getting these results: BASICS Although you ...


1

You can do this in one loop without as custom query. A couple of clever functions should get you there So lets look at a solution. First things first. I would suggest to separate your code completely here for easiness of reading and organisation. Roll back the changes in content.php and use this template only for all other templates. Create a separate ...


0

Ok, I've had a major breakthrough with the multiple loops on the smaller thumbnails and managed to find an answer to question 1. I now just need help with the answer to question 2! Here is the updated code for the thumbnail rows within one loop: <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $args = array( 'post_type' ...


1

Milo noted that there is no $wp_query object in wp-admin page, so we can get $paged via: $paged = ( $_GET['paged'] ) ? $_GET['paged'] : 1; Now that we have $paged, we can code our own pagination. I will demonstrate how in its very simplest form. First let's get maximum pagination pages: $max_pages = $the_query->max_num_pages; Then calculate the ...


1

@Milo solved this one - It was because the posts were imported using an import plugin hence having all the same date bar a few that ticked over every second! All posts must have a unique date / time in order for next and prev links to work.


0

As Milo suggested I had to alter the main query. Followed the following: http://stackoverflow.com/questions/21954101/wordpress-3-8-1-category-page-2-error-404-not-found-custom-post-type?rq=1


0

get_next_posts_link() won't work in is_single() context - see source - and is intended for paged content. For the is_single() context use next_post_link() and previous_post_link() to echo the output. Or to return the output get_next_post_link() and get_previous_post_link().


0

Pagination cannot be reliably implemented in template. It is resolved during load way before template it ever reached. Unless you implement it from scratch (complete with rewrite) you need to be using pre_get_posts or other related hook to modify main query. Look around the site, there are plenty answer on topic of here.


0

Since you using this: get_query_var('page') Try this change of 'paged' to 'page' for the variable name. $wp_query->query('posts_per_page='.$vcount.'&post_type=video&page='.$paged);


3

The 'the_posts' filter hook allows you to edit posts that are going to be displayed in a loop. It's fired for all queries (the main and the secondaries) so you need to check that the query you're acting on is the right one. That said in your case you can: send a query variable to individuate the selected post use 'the_posts' filter to move selected post ...


0

I finally made it work. Leaving the answer here in case someone else have the same problem. <div id="content"> <?php global $paged; global $new_query; $paged = get_query_var('page'); query_posts( array( 'cat' => 251, 'paged' => $paged ) ); $new_query = new ...


0

Right click on next page and previous page links and inspect element (assuming you are using chrome). You will get to know the classes and then style as you like.


1

Do this to output only links for previous and next pages: <?php previous_posts_link ( 'Previous' ) ?> <?php next_posts_link ( 'Next' ); ?> Then add filters to your functions.php to add a class to each link: function next_posts_link_css ( $content ) { return 'class="next"'; } add_filter( 'next_posts_link_attributes', 'next_posts_link_css' ...


0

You can also try below code. function custom_type_archive_display($query) { if (is_post_type_archive('custom_post_type') ) { $query->set('posts_per_page',10); return; } } add_action('pre_get_posts', 'custom_type_archive_display');


0

Refer to the Codex page for paginate_links for all accepted arguments. The two you want to modify are mid_size and possibly end_size. $output .= paginate_links( array( 'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ), 'format' => '?paged=%#%', 'current' => max( 1, get_query_var('paged') ), 'total' ...



Top 50 recent answers are included