Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I've created archive pages for all my taxonomies (taxonomie-{taxonomy-name}.php) and this works fine. The slug of my taxonomies are the same as the slug of it's post-type. This makes it possible to create neat hierarchy in the url, ie:

when post-type 'products' has 'type' as a taxonomy with the values book, cd and dvd. post-type1 has the slug 'product' and taxonomy1 has the same slug: 'product'.

This way I can list the taxonomie-archives in the following way:

products/book products/cd products/dvd

and this works great. However: the pagination works on the products archives but on the products/{type} archive it gives a 404.

Any clue?

Code of the taxonomy template is as follows:

  <?php get_header(); ?>
  <section id="inhoud" class="hfeed">
    <nav class="navigatiebalk">
      <ul class="pagina-navigatie">
        <li class="volgende-pagina"><?php previous_posts_link(''); ?></li>
        <li class="vorige-pagina"><?php next_posts_link(''); ?></li>
      </ul>
    </nav>

    <?php while ( have_posts() ) : the_post(); ?>
    <?php
    $post_type = get_post_type( get_the_ID() );
    ?>
        <article class="hentry publicaties artikel <?php echo $post_type ?>">
            <header class="artikel-hoofd">
            <?php the_title( '<h1 class="titel"><span class="datum date">' . the_date('d.m.y', '', '', false) . '</span><a href="' . get_permalink() . '" title="' . the_title_attribute( 'echo=0' ) . '" rel="bookmark">', '</a></h1>' ); ?>
            <figure class="icoontje"></figure>
            </header>

            <section class="inleiding">
                <figure class="bericht-icoon"><?php $large_image_url = wp_get_attachment_image_src( get_post_thumbnail_id(), 'large'); echo '<a href="' . $large_image_url[0] . '" class="thumbnail-link colorbox" rel="lightbox" title="' . the_title_attribute('echo=0') . '" >'; the_post_thumbnail('thumbnail', array('class' => 'artikel-thumbnail')); ?></a>
                </figure>
                <span><?php $this_excerpt = get_the_excerpt(); echo $this_excerpt; ?>...&nbsp;<a href="<?php the_permalink(); ?>" class="lees-verder">Lees en luister</a>
                </span>
            </section>
        </article>
    <?php endwhile; ?>
    <nav class="navigatiebalk">
      <ul class="pagina-navigatie">
        <li class="volgende-pagina"><?php previous_posts_link(''); ?></li>
        <li class="vorige-pagina"><?php next_posts_link(''); ?></li>
      </ul>
    </nav>
  </section>
  <?php get_footer(); ?>
share|improve this question
    
Whats the code on that page look like? –  Bainternet Feb 20 '11 at 6:03
    
tnx! just updated my post –  grrrbytes Feb 20 '11 at 10:28

2 Answers 2

Figured it out myself. Apparently, the pagination break because both my 'products' and my 'types' (those are not the terms I have, just for demonstration purposes) are having the same slug. Products has a slug of 'products' and types has a slug of 'products/%typename%'. Due to this I can make my permalinks hierarchical: products/dvd or products/cd. It worked, although, it broke both my pagination on taxonomy archive-pages as it broke my permalinks to individual post-types. What I did was the following to fix it:

function add_rewrite_rules($rules) {
    $newrules['([^/]+)/([^\.]+).html$'] = 'index.php?$matches[1]=$matches[2]';
    $newrules['([^/]+)/([^/]+)/page/?([0-9]{1,})/?$'] = 'index.php?post_type=$matches[1]&locations=$matches[2]&paged=$matches[3]';

    $rules = $newrules + $rules;
    return $rules;
}

add_filter('rewrite_rules_array', 'add_rewrite_rules');

I added some mod-rewrite rules so apache will find the paginated taxonomy archive and the individual archive-post.

share|improve this answer
    
After 2 days, THIS is the only thing that worked for me. THANK YOU! THANK YOU! THANK YOU! –  Courtney Elizabeth Dec 30 '11 at 9:46

If I am understanding you correctly, then you have a taxonomy named "type" defined on your site. This will break all sorts of things. "Type" is one of the reserved terms and should not be used for taxonomies.

share|improve this answer
    
ah, no. this was just for demonstration purposes.... so products/page/2 works, but products/dvd/page/2 doesn't... –  grrrbytes Feb 20 '11 at 10:25

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.