• I have set up a custom post type “sagi” and I’m trying to get the post to display on example.com/sagi/ using the following code, but the “« Older Entries” link goes to example.com/sagi/page/2 which does not exist so it brings up the 404, Is there anything that can be done about this or can I only show the 10 latest posts on a page?

    <?php
    
    /*
    Template Name: SaGi
    */
    
    get_header(); ?>
    <?php
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    query_posts('paged=' . $paged . '&post_type=sagi');
    ?>
    <?php if (have_posts()) : ?>
    <?php while (have_posts()) : the_post(); ?>
    <h2><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h2>
    <?php the_content(); ?>
    <?php endwhile; ?>
    
    <?php next_posts_link('&laquo; Older Entries') ?>
    <?php previous_posts_link('Newer Entries &raquo;') ?>
    
    <?php else : ?>
    <?php endif; ?>
    <?php
    
    wp_reset_query();
    ?>
    <?php get_footer(); ?>

The topic ‘Custom type post loop problem’ is closed to new replies.