WordPress.org

Ready to get started?Download WordPress

Forums

Pagination on category/year/ is broken (2 posts)

  1. olesund
    Member
    Posted 4 years ago #

    Hi there.

    I'm using the standard loop to present a list of posts in a certain category (see http://www.frizon.nu/nyheter/). You can also view it as by category AND year like this: http://www.frizon.nu/nyheter/2009.

    My permalinks are: category/year/post-title.

    Pagination works great while looking at the category, but stops working when browsing by year AND category. I get a 404 when trying to reach: http://www.frizon.nu/nyheter/2009/page/2/ but it works for: http://www.frizon.nu/nyheter/page/2/

    Here's my code:

    <?php if (have_posts()) : ?>
    
    			<?php $post = $posts[0]; // Hack. Set $post so that the_date() works. ?>
    			<?php /* If this is a category archive */ if (is_category()) { ?>
    			<h2 class="sub-h2"><?php echo single_cat_title(); ?></h2>
    
    			<?php /* If this is a tag archive */} elseif (is_tag()) { ?>
    			<h2 class="sub-h2"><?php single_tag_title('Etikett: '); ?></h2>
    
    			<?php /* If this is a daily archive */ } elseif (is_day()) { ?>
    			<h2 class="sub-h2">Arkiv för <?php the_time('F jS, Y'); ?></h2>
    
    		 <?php /* If this is a monthly archive */ } elseif (is_month()) { ?>
    			<h2 class="sub-h2">Arkiv för <?php the_time('F, Y'); ?></h2>
    
    			<?php /* If this is a yearly archive */ } elseif (is_year()) { ?>
    			<h2 class="sub-h2">Arkiv för <?php the_time('Y'); ?></h2>
    
    			<?php /* If this is a search */ } elseif (is_search()) { ?>
    			<h2 class="sub-h2">Sökresultat</h2>
    
    			<?php /* If this is an author archive */ } elseif (is_author()) { ?>
    			<h2 class="sub-h2">Författararkiv</h2>
    
    			<?php /* If this is a paged archive */ } elseif (isset($_GET['paged']) && !empty($_GET['paged'])) { ?>
    			<h2 class="sub-h2">Bloggarkiv</h2>
    
    			<?php } ?>
    
    		 <ul class="archive-list">
    		 	<?php while (have_posts()) : the_post(); ?>
    			<li>
    				<span class="archive-date"><?php the_time('Y.m.d'); ?></span>
    				<a href="<?php the_permalink() ?>"><?php the_title(); ?></a>
    			</li>
    
    			<?php endwhile; ?>
    		</ul> 
    
    			<div class="float-left"><?php next_posts_link('&laquo; Äldre inlägg') ?></div>
    			<div class="float-right"><?php previous_posts_link('Nyare inlägg &raquo;') ?></div>
    
    	<?php else : ?>
    
    		<h2 class="sub-h2">404-Not found</h2>
    
    	<?php endif; ?>
  2. MichaelH
    Member
    Posted 4 years ago #

    If you change to the WordPress Default theme what happens?

    Have you updated your permalinks.

Topic Closed

This topic has been closed to new replies.

About this Topic