Wordpress, custom page theme next/previos posts

Posted by user195257 on Stack Overflow See other posts from Stack Overflow or by user195257
Published on 2010-04-02T16:27:58Z Indexed on 2010/04/02 16:33 UTC
Read the original article Hit count: 335

Filed under:

Hi,

I have a custom page template with code:

<?php 
/*
Template Name: Featured
*/
get_header(); ?>

    <div id="content_box">

        <div id="content" class="posts">
        <img src="http://www.dinneralovestory.com/wp-content/uploads/2010/04/favorites.png" alt="Favourites"/><br clear="all" /><br />

        <?php 
        //The Query
        $my_query = new WP_Query('category_name=favourites');
        if ($my_query -> have_posts()) : 
        ?>

            <?php while ($my_query -> have_posts()) : $my_query -> the_post(); ?>

            <div class="featured_box">
                <div class="featured_thumb">
                    <a href="<?php the_permalink(); ?>"><?php the_post_thumbnail(); ?></a>
                </div>
                <div class="featured_content">
<span class="post_title"><?php the_title(); ?></span>
                    <?php the_excerpt(); ?>
                </div>
            </div>  
<br clear="all" /><br />        

            <?php endwhile; ?>

        <?php include (TEMPLATEPATH . '/navigation.php'); ?>

        <?php else : ?>

            <h2 class="page_header center">Not Found</h2>
            <div class="entry">
                <p class="center">Sorry, but you are looking for something that isn't here.</p>
            </div>

        <?php 
        endif; 
        wp_reset_query();
        ?>

        </div>

        <?php get_sidebar(); ?>

    </div>

<?php get_footer(); ?>

The navigation.php file has the previous / next code (it works fine for the standard post pages and archive pages)

navigation.php:

<?php if (is_single()) : ?>

<div class="navigation">
    <span class="previous"><?php previous_post_link('&larr; %link') ?></span>
    <span class="next"><?php next_post_link('%link &rarr;') ?></span>
</div>
<div class="clear whitespace"></div>

<?php else : ?>

<div class="navigation">
    <div class="previous"><?php next_posts_link('&larr; Previous Entries') ?></div>
    <div class="next"><?php previous_posts_link('Next Entries &rarr;') ?></div>
</div>
<div class="clear flat"></div>

<?php endif; ?>

I have set the maximum posts per page to 5, but the page using this theme template wont show the links. Any ideas? What code can i use to get them.

Thankyou

© Stack Overflow or respective owner

Related posts about wordpress-themes