Opened 12 years ago
Last modified 6 years ago
#24705 new enhancement
wp_link_pages() does not showing active current element
Reported by: | Alexufo | Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | major | Version: | 2.2 |
Component: | Posts, Post Types | Keywords: | dev-feedback has-patch |
Focuses: | template | Cc: |
Description
By full analogy of all wp functions, wp_link_pages must generate active class element too.
1 <a href="/2">2</a> <a href="/3">3</a> <a href="/4">4</a>
but should be
<span class="current">1</span> <a href="/2">2</a> <a href="/3">3</a> <a href="/4">4</a>
Attachments (5)
Change History (16)
#2
@
12 years ago
- Summary changed from wp_link_pages() as not shown active element to wp_link_pages() does not showing active element
#6
@
11 years ago
- Cc contact@… added
I updated the previous patch to only add the current
class to the currently active page element.
Adding this to the function might seem like a tiny improvement, but it actually helps a lot if you want to style the active page element via CSS.
@
11 years ago
Alternate patch. Uses if/else
rather than if/elseif
, and more current-page-link
as CSS class
#7
@
11 years ago
- Cc chip@… added
I was just going to open a ticket for this same issue, and found this one. So, I've attached my patch, in case it's helpful. Needless to say: this is much-needed for Theme developers, as targeting the current page element is all but impossible with the current markup being output.
#9
@
11 years ago
Hi All,
I've uploaded an alternate patch, I was wondering if it may be better to name the class differently. I think current-page-link
is a better class name, however paginate_links()
creates links which have the current
class. In addition, I've added the class page-numbers
to the individual links and the current span as well.
This way the output of this function will be compatible with the paginate_links()
function which allows for standardized CSS when developing themes.
#10
@
10 years ago
- Keywords needs-patch added; has-patch removed
- Severity changed from normal to major
- Summary changed from wp_link_pages() does not showing active element to wp_link_pages() does not showing active current element
Please add this on new release asap.
Dont wait more please...
#11
@
6 years ago
- Keywords has-patch added; needs-patch removed
The patch works with WordPress 5.0 ( post-template.php.wp_link_pages.patch ) .
You can also use a filter to add this functionality within your theme. Ex: https://gist.github.com/billerickson/82ac2a970c1eaf5358c363c06cbee72f
I think it would be nice to have built into core, but isn't essential due to the existing filter.
Keywords' changed from needs_patch to has_patch