Support » Plugins » Pagination on Single.php

  • I have a single.php which display content from the post as expected. Below that, I have the following code pulling out posts which are related (in the same category).

    global $post;
    $categories = get_the_category(); //get all categories for this post
    foreach($categories as $category) {
    $args = array(
    'orderby' => 'date',
    'order' => 'DESC',
    'post_type' => 'post',
    'numberposts' => 10,
    'post__not_in' => array($post->ID),
    'category__in' => $cat_ID
    $cat_posts = get_posts($args);
    if ($cat_posts) {
    echo '<section id="related" class="grid_10 prefix_1 suffix_1 alpha omega">';
    echo '<h2>Related</h2>';
    foreach ($cat_posts as $cat_post) {
    <?php  } echo '</section><!-- related -->'; } ?>

    Currently it displays 10 posts.

    My question is: Is it possible to paginate this (single.php) page so that I can display the next 10 posts?

    Thanks for helping.

  • The topic ‘Pagination on Single.php’ is closed to new replies.