• Resolved Bam Bam

    (@bam-bam)


    Hi,

    Can someone help me with this, I have made a Grid Post block using the tutorial HERE but I would like to limit the amount of posts shown and then add pagination to it.

    Kindest Regards
    Bam Bam

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author Ryan Kienstra

    (@ryankienstra)

    Hi @bam-bam,
    Nice, thanks for following that tutorial!

    Hm, did you have in mind JavaScript-driven pagination, like where you click ‘Next’ and it shows the next posts?

    • This reply was modified 4 years, 7 months ago by Ryan Kienstra.
    Thread Starter Bam Bam

    (@bam-bam)

    Something like that, PHP and JS are not my strong points, same kind of thing you would normally see on a WordPress Blog page.

    So maybe show 4 posts and when next is clicked, you get the next 4 or whatever is available.

    I have them showing 4 wide on the page at the moment.

    Bam Bam

    Plugin Author Ryan Kienstra

    (@ryankienstra)

    Hi @bam-bam,
    That sounds interesting.

    As a basic implementation, you might create the block with 2 pages initially, and add a class to the second to hide it.

    On clicking a ‘Next’ button, it could hide the first block, and show the next.

    Thread Starter Bam Bam

    (@bam-bam)

    Not sure how to go about it, but where there is a will there is generally a way, been playing around with JS a bit lately, may be able to do something with that.

    Plugin Author Ryan Kienstra

    (@ryankienstra)

    Haha, good way to put it ??

    You could add a click event listener to the ‘Next’ button that would remove the class that hid the next page.

    That class might have a style rule display: none

    If it’s alright, I’m going to close this topic.

    Thread Starter Bam Bam

    (@bam-bam)

    May as well if there is no easier way to do it in the block itself.

    Plugin Author Ryan Kienstra

    (@ryankienstra)

    Sorry, there’s no built-in way to do that in Block Lab.

    Thread Starter Bam Bam

    (@bam-bam)

    On reflection I might duplicate the block and modify it to show all posts instead of only the 4 most recent and add a button to the current one that says Read older posts and direct it to another page.

    Plugin Author Ryan Kienstra

    (@ryankienstra)

    That sounds good!

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Add Pagination to a Grid Post Block’ is closed to new replies.