Make WordPress Core

Opened 18 years ago

Last modified 6 months ago

#7231 accepted enhancement

wp_link_pages: option next_and_number

Reported by: jan831's profile jan831 Owned by: sorich87's profile sorich87
Milestone: Future Release Priority: normal
Severity: normal Version:
Component: Posts, Post Types Keywords: has-test-info has-patch
Focuses: template Cc:

Description

with the next_or_number option of the wp_link_pages() function, it would be nice to have the option to use both.

it gives the user the opportunity to easily go to the next/previous page, without loosing the other option of going immediately to a certain page

example:
next 1 2 3 4 5 6 previous

Attachments (11)

patch_next_and_number.diff (3.1 KB) - added by jan831 18 years ago.
patch to add this functionality (applies to /trunk/)
7231.patch (4.0 KB) - added by sorich87 16 years ago.
7231.2.patch (8.6 KB) - added by seanchayes 10 years ago.
2015-pagination-styling-issue.jpg (62.8 KB) - added by seanchayes 10 years ago.
2015 displaying styling issue
2015-pagination-with-adjusted-styling.jpg (75.4 KB) - added by seanchayes 10 years ago.
2015 with adjusted styling
2016-pagination-styling-issue.jpg (49.4 KB) - added by seanchayes 10 years ago.
2016 displaying styling issue
2016-pagination-with-adjusted-styling.jpg (50.6 KB) - added by seanchayes 10 years ago.
2016 with adjusted styling
7231-latest.patch (1.8 KB) - added by dhruvang21 6 months ago.
Screenshot from 2025-08-26 16-44-42.png (88.7 KB) - added by dhruvang21 6 months ago.
Screenshot from 2025-08-26 16-44-42.2.png (88.7 KB) - added by dhruvang21 6 months ago.
Screenshot from 2025-08-26 16-44-30.png (97.5 KB) - added by dhruvang21 6 months ago.

Download all attachments as: .zip

Change History (27)

@jan831
18 years ago

patch to add this functionality (applies to /trunk/)

#1 @jan831
18 years ago

  • Keywords has-patch added

#2 @ryan
17 years ago

  • Milestone changed from 2.7 to 2.8

Moving enhancements to 2.8.

#3 @Denis-de-Bernardy
17 years ago

  • Keywords needs-patch added; has-patch removed
  • Milestone changed from 2.8 to Future Release

broken patch

#4 @Denis-de-Bernardy
17 years ago

  • Component changed from General to Template

#5 @Denis-de-Bernardy
17 years ago

  • Milestone changed from Future Release to 2.9

#6 @ryan
16 years ago

  • Milestone changed from 2.9 to Future Release

@sorich87
16 years ago

#7 @sorich87
16 years ago

  • Keywords has-patch added; needs-patch removed
  • Owner changed from anonymous to sorich87
  • Status changed from new to accepted

Here is a new patch.

#8 @nacin
12 years ago

  • Component changed from Template to Posts, Post Types
  • Focuses template added

#9 @wonderboymusic
10 years ago

  • Keywords needs-refresh added

#10 @seanchayes
10 years ago

Ok. I've reworked this patch and uploaded 7231.2.patch

There appears to be no default styling in Twenty Fourteen, TwentyFifteen or TwentySixteen accommodate for the "Next" and "Previous" links created by this function before this patch. As such in the course of creating this patch I manually added styling to those themes for testing. Samples of what I saw for these themes have also been uploaded.

My patch also adds classes, "next" and "previous" to the relevant links to allow for them to be styled. See below.

.page-links .previous,
.page-links .next {
        width: auto;
}

I don't know how best to address this within the patch. So, my guess is to open an additional ticket for that styling to be considered for inclusion.

And now, the parameter "next_or_number" now is mis-named as the existing two options now included a third. I suspect we would keep the parameter name for the time being and/or introduce something like "pagination_style" going forward. I have left the parameter name as is for the time being.

@seanchayes
10 years ago

#11 @seanchayes
10 years ago

  • Keywords needs-testing added

@seanchayes
10 years ago

2015 displaying styling issue

@seanchayes
10 years ago

2015 with adjusted styling

@seanchayes
10 years ago

2016 displaying styling issue

@seanchayes
10 years ago

2016 with adjusted styling

#12 @seanchayes
10 years ago

In the "styling issue" images I have highlighted the white on white text to make it show - for the purposes of demonstrating the issue.

#13 @wonderboymusic
10 years ago

#10558 was marked as a duplicate.

This ticket was mentioned in Slack in #core-test by sirlouen. View the logs.


6 months ago

#15 @SirLouen
6 months ago

  • Keywords needs-patch has-test-info added; has-patch needs-refresh needs-testing removed

It seems this report lost all the momentum some years ago. It's still valid though and it seems it was already approved back in the day.

This needs a massive refresh as many things have changed since then. If anyone is willing to retake the challenge of building this little enhancement, I will set it back as needs-patch because a simple refresh is not enough, it requires a full rebuild almost from scratch (although some things from the previous patches are still valid and could be useful).

#16 @dhruvang21
6 months ago

  • Keywords has-patch added; needs-patch removed

@SirLouen I’ve created a new patch. You can test it by adding the following snippet:

'next_or_number' => 'next_and_number',

inside the wp_link_pages function.

I’ve tested it with the Twenty Twenty theme and attached screenshots for reference. I’d appreciate your suggestions and code review. If everything looks good, I’ll go ahead and create a PR as well.

Note: See TracTickets for help on using tickets.