WordPress.org

Make WordPress Core

Opened 4 months ago

Last modified 3 months ago

#47657 new feature request

Menu: In wp_link_pages() function add new args to wrap a tag

Reported by: sandrowuermli Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Menus Keywords: needs-patch dev-feedback
Focuses: Cc:
PR Number:

Description

In the function wp_link_pages() the $args link_before and link_after are confusing for me.
IMHO link_before should be before link. Because pagelink
is for wrapping the text inside the link: 'pagelink' => '<span class="test">%</span>'
for example will be ’<a href="…" class="…"><span class="test">3</span></a>’.
But you can do the same thing with 'link_before' => '<span class="test">', 'link_after' => '</span>'.

If there are new $args params, link_wrap_before for example, would be much easier to create a bootstrap pagination for example.

$args = [ 'link_wrap_before' => '<li class="list-item">', 'link_wrap_after' => '</li>']

should output:

<li class="list-item"><a href="…">…</a></li>

Attachments (1)

Artboard.png (268.4 KB) - added by sandrowuermli 4 months ago.
Code example

Download all attachments as: .zip

Change History (2)

@sandrowuermli
4 months ago

Code example

#1 @mukesh27
3 months ago

  • Keywords needs-patch dev-feedback added
  • Summary changed from wp_link_pages() args to wrap "a"-tag to Menu: In wp_link_pages() function add new args to wrap a tag

Hi @sandrowuermli,

Welcome to WordPress Trac! Thanks for the ticket.

+1 for your thought.

In core system needs to add two new arguments like( wrap_link_before and wrap_link_after ) in wp_list_pages function to wrap page link.

Note: See TracTickets for help on using tickets.