0

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

https://gyazo.com/1cd8689cba6d352f9c7fad28255b78ab

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]);
        if(empty($aProjects[$sLetter]))
        {

            $aProjects[$sLetter][] = $oProject;
        }
        else
        {

            $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.