Forums

is there a function similar to that I can call? (2 posts)

  1. Quakebum
    Member
    Posted 1 year ago #

    I'm using get_posts to display posts on a page.

    I'd like to be able to split up the page so it only display 50 posts at a time.

    One way (I hope) that would allow me to do this is, add a counter in to get_post loop, every time it hits 50, it will add a <!--nextpage-->, then reset.

    I know adding the quicktag <!--nextpage--> doesn't work (I tried), is there a function that I can call that does what nextpage does?

    Is a better way to automatically split a page up?

  2. esmi
    Theme Diva & Forum Moderator
    Posted 1 year ago #

    <?php
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    $args= array(
        'category_name' => 'News',
        'posts_per_page' => 50,
        'paged' => $paged
    );
    get_posts($args);
    
    [rest of the loop]

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.