In Pagenation, how to set the number of posts per page and delete the page number?

I would like to make an inquiry.
I think I’ve been asking a lot about PageNation.

I’m using this code right now.
Link. The Page

<!-- pagination -->

<?php $pagination = $list->pagination() ?>
	<nav class="numberset">
		<ul>

				<?php if ($pagination->hasPrevPage()): ?>
			    <li class="leftstroke">
			      <a href="<?= $pagination->prevPageURL() ?>"><!-- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 35.67 26.95"><defs><style>.a{fill:#040000;}</style></defs><polygon class="a" points="2.91 10.48 2.91 10.56 0 13.48 2.91 16.39 2.91 16.48 3 16.48 13.48 26.95 17.72 22.71 11.49 16.48 35.67 16.48 35.67 10.48 11.49 10.47 17.72 4.24 13.48 0 3 10.47 2.91 10.48"/></svg> -->Previous</a>
			    </li>
			    <?php else: ?>
			    <li class="leftstroke" style="color: #a7a7a7">
			      Previous
			    </li>
			    <?php endif ?>

				<span class="numbers-set">
				    <?php foreach ($pagination->range(12) as $r): ?>
				    <li class="numbers">
				      <a<?= $pagination->page() === $r ? ' aria-current="page"' : '' ?> href="<?= $pagination->pageURL($r) ?>">
				        <?= $r ?>
				      </a>
				    </li>
				    <?php endforeach ?>
				</span> 

			    <?php if ($pagination->hasNextPage()): ?>
			    <li class="rightstoke">
			      <a href="<?= $pagination->nextPageURL() ?>">Next</a>
			    </li>
			    <?php else: ?>
			    <li class="rightstoke" style="color: #a7a7a7">
			      <span><!-- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 35.67 26.95"><defs><style>.a{fill:#040000;}</style></defs><polygon class="a" points="32.75 16.48 32.75 16.39 35.67 13.48 32.75 10.56 32.75 10.48 32.66 10.47 22.19 0 17.95 4.24 24.18 10.47 0 10.48 0 16.48 24.18 16.48 17.95 22.71 22.19 26.95 32.66 16.48 32.75 16.48"/></svg> -->Next</span>
			    </li>
		<?php endif ?>

		</ul>
	</nav>
<!-- pagination -->

You can see six posts on the page, and there are buttons at the bottom like “Previous Page,” “Next Page,” and "Page Number (1,2,3…).
The client wants to delete the page number and leave only the ‘previous page’ and ‘next page’.
But if I delete the page number code, where should I enter that there are six posts on the page? Now it looks like it’s combined with the page number.

And this is what I’m curious about, if we put the page number as a number and assume that the page is 50 pages, I don’t see all the numbers from 1 to 50 and it will be omitted in the middle, right?
1, 2, 3, 4, 5, … 50 ← Like this.
What can I do about this?

Or I want to know how to write “current pages” of “total pages.”
1 of 50 ← Like this…

I’m studying infinite scrolling, but before that, I want to make the most of PageNation and work on it. I need help. Thank you!

Check out the pagination class docs for the available methods:

Interesting for your use case:

$pagination->pages() return the total number of pagination pages
$pagination->page() returns the current page number

1 Like