• Resolved morris373

    (@morris373)


    Hi
    I have tried now for a few days to get the pagination to work and can’t get it to work.

    I have tried this code in a page template:

    // Pods Pagination for template file
    $pod = pods( 'grave' );
    
    $params = array( 'limit' => 9 );
    $pod->find( $params );
    
    // Advanced Pagination
    echo $pod->pagination( array( 'type' => 'advanced' ) );
    
    // Simple Pagination
    echo $pod->pagination( array( 'type' => 'simple' ) );
    
    // Paginate
    echo $pod->pagination( array( 'type' => 'paginate' ) );

    It shows the number of pages but when you click the next page, it just shows you the same items.

    I have even tried adding pagination to the shortcode and it doesn’t appear on the page:

    [pods name="grave" limit="9" template="Grave Blog Template" pagination="true"]

    What could be the problem?

    Morris

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author Jory Hogeveen

    (@keraweb)

    This is because the pagination is linked to the results of the actual query.

    The shortcode solution should work, are you sure there are more than 9 items at the moment?

    Cheers, Jory

    Thread Starter morris373

    (@morris373)

    Hi Jory
    At the moment I only have 10 Graves and I want to limit the Graves per page to 9 only as it gives me a complete block on the one page. I want to get it working first on a localhost website and then put it onto the main website.

    I am using Mesmerize’s blog page or code to output the Graves into like blog items, which uses Cards and it’s perfect for what I want.

    This is how I did it using another CPT plugin.

    Graves

    WHen I first started this project, I based it on the Graves only and with the deceased person buried there. I didn’t know how else to do it.

    Now, I just want to display all of the Burial Register (36 pages with 282 deceased people) so people can search it on the website like another local church has done. My only problem is my knowledge of PHP programming and using templates.

    Cheers for your constant help.

    Morris

    Plugin Author Jory Hogeveen

    (@keraweb)

    Hello @morris373

    In that case you’ll need to enable pagination support in your Mesmerize’s blog page.
    Since this is theme customization it’s outside of Pods support.
    A topic I’ve found that could help you: https://stackoverflow.com/questions/31217677/how-to-add-custom-pagination-in-wordpress

    Cheers, Jory

    Thread Starter morris373

    (@morris373)

    Hi
    I viewed a video you suggested and it made better sense but I am still getting a bit confused.

    When I set up the 2 CPTs, I didn’t enable the archive page, so I did that and I changed the page slug. I can now get all of the deceased people and all the graves onto their own separate page and now the theme’s built in pagination works.

    Before enabling the archive page, I had used a php template file that I have on my other website and changed the fields and post type and that worked for one of the post types i.e. deceased. The Grave CPT, I wanted to add all graves, add all deceased people in that same grave and I didn’t know how to. That’s why I asked about the [each grave_number] as I would have needed the equivalent code to modify my template.

    But how can you alter the archive page to show more details, say for each grave? At the moment all I am getting is just the page title and no custom fields.

    On the older videos, the auto templates section mentions the Archive template to use but that is not on the newer version 2.7.25 I am using now.

    Thanks

    Morris

    Plugin Author Jory Hogeveen

    (@keraweb)

    Hello @morris373

    As we also explain in our video. You can use our auto template function for that. With this you could replace or append the custom Pods templates to the archive pages.

    If you need more flexibility in the output of your HTML you’ll have to get familiar with pagination in WordPress and your theme (using PHP). This is outside of the scope for Pods.

    Cheers, Jory

    Thread Starter morris373

    (@morris373)

    Hi Jory
    I still can’t see how I can add a custom template to use just for an archive page.

    Old video shows where to put it probably in an older version of Pods but I don’t have that option on mine or the label has been changed.

    I have Singular Template and I have List Template but no Archive Template so where am I adding this Custom template please? I need to change how the Archive page looks as it has no custom fields in it.

    Morris

    Plugin Author Jory Hogeveen

    (@keraweb)

    Hi @morris373

    The list template IS the archive template. It’s a different name for the same thing.
    We changed the name from Archive to List since it’s a more general name for a list of items. (an archive is a page that shows a list of items…)

    Cheers, Jory

    Thread Starter morris373

    (@morris373)

    Hi Jory
    But that makes no sense calling it something else and I can’t find anything about it in your documentation, then I am told I can’t change the look of the auto generated Archive page unless I create a PHP page template.

    I get told to watch this particular video and that will help, well it doesn’t because the version of Pods is different and it uses Archive instead of Lists in the Pods settings. So if you are trying to learn the basics it gets very hard when items change in other versions.

    Watching some of your videos, I am sure it says, I won’t need to touch anymore PHP files as the Pods templates does that job. For me it is easier to use your Pods templates as I can see the fields I need referenced down the right side bar.

    I have added the template under Lists and it doesn’t change the look of the Archive page. The CPT has Archive set and with a page slug.

    Anyhow I can get all of the records for a CPT or Pod from using your Pods Templates so that kind of making the auto archive page redundant.

    Morris

    Thread Starter morris373

    (@morris373)

    Hi
    I have created a ‘page’ template from a theme template with a right sidebar and I have saved it as page-(page-slug).php, where page-slug is the slug name of the page I created in WordPress i.e. page-baptisms.php

    I then added the pagination code below just outside of the loop:

    $pod = pods( 'baptism' );
    $params = array( 'limit' => 2 );
    $pod->find( $params );
    // Paginate
    echo $pod->pagination( array( 'type' => 'paginate' ) );

    Pods shortcode is as follows:

    [pods name="baptism" limit="2" orderby="baptism_date ASC" template="Baptism Grid Template"]

    Both limits have to be the same for pagination to work properly.

    At long last, I now have the pagination working and have it placed where it should be placed i.e. outside of the loop in its own Div.

    Morris

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Can’t get pagination to work’ is closed to new replies.