Pagination with custom post type
-
So, I have read endless “solutions” and have spent hours troubleshooting this but still nothing so I’m hoping posting here (my first time posting) will give me the solution I so desperatly need!
My problem: I have a post type called “Links” which displays lists of urls from three different taxonomies. There are three rows for each taxonomy and each one is supposed to display 3 urls and a link to see previous urls. The previous link shows a 404, and I can’t seem to fix it no matter what I do.
My code:
$paged = ( get_query_var( 'paged' ) ) ? get_query_var('paged') : 1; $args = array( 'post_type' => 'lenker', 'lenketyper' => 'vitenskapelige-publikasjoner', 'posts_per_page' => 2, 'paged' => $paged ); $loop = new WP_Query( $args ); while ( $loop->have_posts() ) : $loop->the_post(); { $url_excerpt = get_the_excerpt(); if ( $url_excerpt != '' ) { ?> <span class="bullet"></span><a href="<?php echo $url_excerpt; ?>"><?php the_title(); ?> </a> <?php echo '</br>'; } } endwhile; ?> <?php previous_posts_link('« Forrige', $loop->max_num_pages); ?> <?php next_posts_link('Neste »', $loop->max_num_pages); ?>
I have added
'rewrite' => array( 'slug' => 'lenke' ),
to my post type and gone to “Settings” > “Permalinks” And clicked “Save Changes” (I have also reset the permalinks).Hope the question wasn’t to badly written!
Link to the site: http://tinahaaskjold.com/ntnu/lenke/
the first column is the one the code above is used on.
- The topic ‘Pagination with custom post type’ is closed to new replies.