Opened 13 years ago
Closed 7 months ago
#24705 closed enhancement (wontfix)
wp_link_pages() does not showing active current element
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Priority: | normal | |
| Severity: | major | Version: | |
| 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 (17)
#2
@
13 years ago
- Summary changed from wp_link_pages() as not shown active element to wp_link_pages() does not showing active element
#6
@
13 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.
@
12 years ago
Alternate patch. Uses if/else rather than if/elseif, and more current-page-link as CSS class
#7
@
12 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
@
12 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
@
11 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
@
7 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.
#12
@
7 months ago
- Milestone Awaiting Review deleted
- Resolution set to wontfix
- Status changed from new to closed
- Version 2.2 deleted
As @billerickson commented, adding code having the filter makes this not strictly necessary and given that this report has completely lost the traction and the fact that we are progressing into newer grounds, it doesn't seem to be a good enhancement for now. For all of these reasons, I'm closing this as wontfix
Keywords' changed from needs_patch to has_patch