Numerical pagination behaving poorly in WordPress

Using the approach outlined here (wpbeginner.com/wp-themes/how-to-add-numeric-pagination-in-your-wordpress-theme/), and I noticed a few issues with the default behavior.

Issue 01:
(source: test-hdwg.pantheon.io/news/)
When only two pages are produced in the pagination sequence, when you click the second page (2), you will see the class=“active” still attached to the first page (1). However, it appears to function properly in another instance (test-hdwg.pantheon.io/?s=catalyst) where only 2 “pages” exist – any idea(s) why?

Issue 02:
(source: test-hdwg.pantheon.io/?s=health)
If a page has > 4 “pages”, when viewing page 5 in the source example, the pagination link for “page” 2 disappears, which I believe should of been replaced by a “…”.

Hope someone out there can shed a little light on this. To eliminate clutter in this question, I’ve created a pastebin (pastebin.com/dwevKqR5) with the PHP that operates the pagination in question.

I found help through another community, thanks anyway.

Sponsor our Newsletter | Privacy Policy | Terms of Service