Support » Fixing WordPress » Again about custom post type pagination

  • Hello Guys,

    I am a PHP newbie, so this is why i start this topic even though I saw this problem discussed over and over again on the support forums.

    I own an affiliate product website so I use the index of the theme to display a list of posts that belong to a custom post type.

    The first page works fine, but when I click the ¨Older Entries¨ link i just get a 404 Error.

    I tried installing the Category Pagination Fix plugin but it doesn´t seem to work ( http://wordpress.org/extend/plugins/category-pagination-fix/ )

    I read something about declaring the $paged variable in the query that gets the posts, but I wasn’t able to make it work.

    Also, my permalink structure is %category&/&postname%

    So, below is my index.php file. Could you please tell me how it should look like so that the pagination would work?

    <?php
    if(get_option('ebuy_home') == "blog") { ?></li>
    
    <?php include (TEMPLATEPATH . '/lib/blog-home.php'); ?>
    <?php } else { ?>
    
    <div id="content">
    
    <?php include (TEMPLATEPATH . '/slider.php'); ?>	
    
    <h3 class="r-title"> Cele mai noi produse</h3>
    
    <?php
    $temp = $wp_query;
    $wp_query= null;
    $wp_query = new WP_Query();
    $wp_query->query('post_type=goods'.'&paged=' .$paged);
    ?>
    <?php $count = 0; ?>
    <?php while ($wp_query->have_posts()) : $wp_query->the_post(); ?>	
    
    <div class="box <?php if (++$count % 3 == 0) { echo "lastbox"; } ?>" id="post-<?php the_ID(); ?>">
    
    <div class="btitle">
    	<h2><a>" rel="bookmark" title="Detalii despre <?php echo get_post_meta($post->ID, 'titlu', true); ?>"><?php echo get_post_meta($post->ID, 'titlu', true); ?></a></h2>
    </div>
    
    <div class="boxim">
    <?php
    if ( has_post_thumbnail() ) { ?>
    	<a>"><img class="boximg" src="<?php bloginfo('stylesheet_directory'); ?>/timthumb.php?src=<?php get_image_url(); ?>&h=150&w=150&zc=1" alt=""/></a>
    <?php } else { ?>
    	<a>"><img class="boximg" src="<?php bloginfo('template_directory'); ?>/images/dummy.png" alt="" /></a>
    <?php } ?>
    </div>
    
    <div class="boxmeta clearfix">
    <span class="p-cost"> <?php tp_the_product_field( 'price' ); ?> </span>
    <span class="p-link"> <a>">Detalii</a> </span>
    </div>
    </div>
    <?php if(++$counter % 3 == 0) : ?>
    <div class="clear"></div>
    <?php endif; ?>
    <?php endwhile; ?>
    
    <div class="clear"></div>
    
    <div class="nav-previous"><?php next_posts_link(__('<span class="meta-nav">«</span> Older posts', 'thematic')) ?></div>
    <div class="nav-next"><?php previous_posts_link(__('Newer posts <span class="meta-nav">»</span>', 'thematic')) ?></div>
    <?php $wp_query = null; $wp_query = $temp;?>
    
    </div>
    
    <?php } ?>
    
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>

    Thank you for your patience!

    Also, the url of the website is: http://www.maller.ro

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Again about custom post type pagination’ is closed to new replies.