I have this archive page where I'm displaying some cards. I've run into a problem where cards would duplicate to next page.


The thing is that theres around 15 posts. 10 of them are showing in the first page and last 5 on the next page. Instead of showing me title and etc. for the last 5 posts on page 2, it simply duplicates/overrides from page 1 to page 2.

See my code here: http://codepad.org/J6hKQHDA

IF I remove

$posts = get_posts([
      'post_type'       => 'php',
      'post_status'     => 'publish',
      'numberposts'     => -1,
      'orderby'         => 'date',
      'order'           => 'DESC',

    $aProjects = array();
    foreach ($posts as $pkey => $oProject) 
        $sLetter = strtoupper($oProject->post_title[0]);

            $aProjects[$sLetter][] = $oProject;

            $aProjects[$sLetter][] = $oProject;

It works. But I do need this code. So, why would this code stop my pagination from running correctly?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.