Well, I looked at it for almost an hour and can't get it to work. I use WordPress and I have 12 posts in the system. In admin, I set it to display 5 posts per page. In my topic I am trying to show the pagination (prev, 1,2,3,4, next) below. I found the paginate_links () function in the WordPress tutorials and didn't print anything ... Any help is appreciated:
<?php get_header(); ?>
<div class="middle-container">
<div class="middle">
<div class="column main">
<div class="latest">
<?php
$i = 0;
if (have_posts()):
while (have_posts() && $i < 1):
the_post();
?>
<div class="image"><a href="<?php the_permalink() ?>" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_post_thumbnail(); ?></a>
</div>
<div class="content">
<h1><a href="<?php the_permalink() ?>" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h1>
<span class="date"><?php the_time('F jS, Y') ?></span>
<?php
the_excerpt();
?>
</div>
<?php
$i++;
endwhile;
endif;
?>
</div>
<ul class="posts">
<?php
$i = 0;
if (have_posts()):
while (have_posts() && $i < 4):
the_post();
?>
<li>
<h2><a href="<?php the_permalink() ?>" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
<span class="date"><?php the_time('F jS, Y') ?></span>
<?php
the_excerpt();
?>
</li>
<?php
$i++;
endwhile;
endif;
?>
</ul>
<?php
echo paginate_links();
?>
</div>
<div class="column sidebar"></div>
</div>
</div>
<?php get_footer(); ?>
A little more about this: the first while loop in the code captures the first message in the list and displays it in its special block. The second while loop captures the remaining 4 messages. Both of these loops work fine. Pagination is simply not printed.
source
share