• Hi there,

    I’m developing a site where the client wants everything tagged ‘story’ to be displayed on the homepage.

    I have created the php code for the loop – below, which also shows wp-pagination:

    <div id="content">
    	<?php if (have_posts()) : ?>
         	<?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; query_posts("tag=story&showposts=5"); ?>
            <?php while (have_posts()) : the_post(); ?>
    		<div id="post-<?php the_ID(); ?>" class="<?php thematic_post_class(); ?>">
        	<h2 class="entry-title"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
    		<div class="entry-content"><?php thematic_content(); ?></div>
    		</div> <!-- end post -->
    <?php endwhile; endif; ?>
    
    <?php if(function_exists('wp_paginate')) { wp_paginate(); } ?>
    </div><!-- #content -->

    However, when clicking on the pagination the following url is created:

    https://www.websitename.com/page/2/

    >> needs to be https://www.websitename.com/tag/story/page/2/

    This obviously leads to a 404. How can I add to the code to insert /tag/story before the /page so that it works..

    <?php if(function_exists(‘wp_paginate’)) { wp_paginate(); } ?>

    Can extra code be added to this?

    Many thanks for your help

    Jim

  • The topic ‘query post – showing next page of tagged posts with wp-paginate’ is closed to new replies.