Make WordPress Core

Opened 18 years ago

Last modified 13 months ago

#7231 accepted enhancement

wp_link_pages: option next_and_number

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

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 11 years ago.
2015-pagination-styling-issue.jpg (62.8 KB ) - added by seanchayes 11 years ago.
2015 displaying styling issue
2015-pagination-with-adjusted-styling.jpg (75.4 KB ) - added by seanchayes 11 years ago.
2015 with adjusted styling
2016-pagination-styling-issue.jpg (49.4 KB ) - added by seanchayes 11 years ago.
2016 displaying styling issue
2016-pagination-with-adjusted-styling.jpg (50.6 KB ) - added by seanchayes 11 years ago.
2016 with adjusted styling
7231-latest.patch (1.8 KB ) - added by dhruvang21 13 months ago.
Screenshot from 2025-08-26 16-44-42.png (88.7 KB ) - added by dhruvang21 13 months ago.
Screenshot from 2025-08-26 16-44-42.2.png (88.7 KB ) - added by dhruvang21 13 months ago.
Screenshot from 2025-08-26 16-44-30.png (97.5 KB ) - added by dhruvang21 13 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
18 years ago

  • Milestone 2.72.8

Moving enhancements to 2.8.

#3 @Denis-de-Bernardy
17 years ago

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

broken patch

#4 @Denis-de-Bernardy
17 years ago

  • Component GeneralTemplate

#5 @Denis-de-Bernardy
17 years ago

  • Milestone Future Release2.9

#6 @ryan
17 years ago

  • Milestone 2.9Future Release

@sorich87
16 years ago

#7 @sorich87
16 years ago

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

Here is a new patch.

#8 @nacin
13 years ago

  • Component TemplatePosts, Post Types
  • Focuses template added

#9 @wonderboymusic
11 years ago

  • Keywords needs-refresh added

#10 @seanchayes
11 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
11 years ago

#11 @seanchayes
11 years ago

  • Keywords needs-testing added

@seanchayes
11 years ago

2015 displaying styling issue

@seanchayes
11 years ago

2015 with adjusted styling

@seanchayes
11 years ago

2016 displaying styling issue

@seanchayes
11 years ago

2016 with adjusted styling

#12 @seanchayes
11 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
11 years ago

#10558 was marked as a duplicate.

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


13 months ago

#15 @SirLouen
13 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
13 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.