treehouse : what would you like to learn today?
Web Design Web Development iOS Development

Wordpress Issue

  • Hey everyone. I am using a custom page for my blog section on my wordpress site. I can get it to display all my posts buy i wanted to know how to add pagination to this page.
    Here is the code I have so far:
    			<ul id="blog-posts">
    <?php
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    $args = array(
    'numberposts' => 999999,
    'paged' => $paged,
    'posts_per_page' => 3
    );
    $lastposts = get_posts( $args );
    foreach($lastposts as $post) : setup_postdata($post); ?>
    <li id="post-list"><a href="<?php the_permalink(); ?>"><h2><?php the_title(); ?></h2>
    <?php the_excerpt(); ?></a>
    <h5><a href="<?php the_permalink(); ?>#comments"><?php comments_number( 'No Comments', '1 Comment', '% Comments' ); ?></a></h5>

    <img src="<?php bloginfo('template_directory'); ?>/img/ico/feed.png" class="feed" /></li>
    <?php endforeach; ?>
    <li><div class="navigation">
    <div class="alignleft"><?php next_posts_link('&laquo; Older Entries') ?></div>
    <div class="alignright"><?php previous_posts_link('Newer Entries &raquo;') ?></div></div></li>
    </ul>


    The problem I am having is that the links aren't showing up at the bottom of the page in fact all I am getting is a blank with nothing in it. Can anyone see where I am going wrong please as this is driving me nuts.

    Cheers everyone.
    Phil