Pagination in custom template
-
Hi guys,
I am totally new to WordPress and made my first custom template with five static pages and one page showing posts, like a mini diary in a static website.
Now I have set to show four posts per page, but I do not get the next/older posts buttons. I also tried two plug-ins but that did not work.
Can you show me how to get the “next page/posts” button under all the posts?
Here is my code:
<?php get_header(); ?>
<?php
global $post;
$paged = get_query_var( ‘paged’ ) ? get_query_var( ‘paged’ ) : 1;
$args = array(
‘posts_per_page’ => 4,
‘paged’ => $paged
);$myposts = get_posts( $args );
foreach( $myposts as $post ) :
setup_postdata($post); ?>
<p class=’day’><?php the_time(‘d’); ?></p>
<p class=’month’><?php the_time(‘M’); ?></p>
<p class=’year’><?php the_time(‘Y’); ?></p>
<?php the_title(); ?>
<?php the_content(); ?>
<?php edit_post_link(‘– Eintrag bearbeiten’, ‘<p>’, ‘</p>’); ?>
<?php endforeach; ?><?php get_footer(); ?>
Thank you in advance.
- The topic ‘Pagination in custom template’ is closed to new replies.