user979331
user979331

Reputation: 11851

Wordpress Replace Pagination with Numbers

I have this old school pagination like so:

<?php if ($wp_query->max_num_pages > 1) : ?>
            <nav class="post-nav">
                <ul class="pager">
                    <li class="previous"><?php next_posts_link(esc_html__('&larr; Older posts', THEMO_TEXT_DOMAIN)); ?></li>
                    <li class="next"><?php previous_posts_link(esc_html__('Newer posts &rarr;', THEMO_TEXT_DOMAIN)); ?></li>
                </ul>
            </nav>
            <?php endif; ?>

How would I replace a number pagination, how would I go about doing this?

Upvotes: 0

Views: 2662

Answers (2)

Robi
Robi

Reputation: 168

I think you missed the trick of paginate_links function. Read this documentation link https://developer.wordpress.org/reference/functions/paginate_links/

With this you can create numeric pagination link of any custom posts or you can modify your default numeric pagination behavior.

Upvotes: 0

nanika
nanika

Reputation: 91

You can use a plugin WP-PageNavi (Source: https://wordpress.org/plugins/wp-pagenavi/) or you can do it manually, you can view the codes here https://www.wpbeginner.com/wp-themes/how-to-add-numeric-pagination-in-your-wordpress-theme/ Hope this helps. :)

Upvotes: 1

Related Questions