Support » Fixing WordPress » Pagination global $post

  • Hello everyone,
    Having trouble getting my head around Pagination.
    I looked at pother similar posts but can’t seem to understand what to do. Have the loop below getting the latest 10 posts on the news page, but want to add pagination at the bottom to retrieve the next 10 on the next page. footballismore.org/medien/news/

    Code as follows:

    <?php global $post;
    	$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    	$tmp_post = $post;
    	$args = array( 'category__in' => 7, 'posts_per_page' => 10, 'orderby' => 'date', 'order' => 'DESC', 'paged'=> $paged );
    	$myposts = get_posts( $args );
    	foreach( $myposts as $post ) : setup_postdata($post); ?>
        <div class="news">
        <?php the_post_thumbnail(); ?>
    	<h2><?php the_title(); ?></h2>
        <div id="date" class="sidebar">
        <em><?php the_time('F j, Y') ?></em>
    	</div><!--close date-->
        <?php the_content(__('Read more...','en_US'), $strip_teaser, $more_file); ?>
        </div>
        <?php endforeach; ?>
    	<?php $post = $tmp_post; ?>

    I know I need to add the links or page numbers but not sure how or even if this above code is correct. Thanks in advance for any help!

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Pagination global $post’ is closed to new replies.