WordPress.org

Make WordPress Core

Opened 6 years ago

Closed 4 years ago

#28433 closed enhancement (wontfix)

allow for more control on paginate_links list element

Reported by: FrancescoRizzi Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.0
Component: General Keywords: needs-patch needs-docs
Focuses: ui, template Cc:

Description

paginate_links allows the caller to specify type='list'.
However, it does not provide any mean to control the ul element created under these conditions by source:trunk/src/wp-includes/general-template.php@head#L2525

There are many possibilities to enhance this, of course; personally I'd find useful to have the ability of specifying an id and/or additional CSS classes to be used for that element.

Change History (6)

#1 @wonderboymusic
6 years ago

  • Keywords needs-patch needs-docs added
  • Milestone changed from Awaiting Review to Future Release

I could imagine a filter on the HTML output

#2 @SergeyBiryukov
5 years ago

#30030 was marked as a duplicate.

#3 @SergeyBiryukov
5 years ago

  • Focuses template added

#4 @obenland
5 years ago

I'm not sure paginate_links() is supposed to be a full fledged template tag. It's more meant to be a low-level helper function to, well, paginate links.

The ul element already has a class name, why can't that be used to style it? And the easiest way to enhance it would probably be to wrap it in an HTML tag with an id or class.

I'd suggest wontfix.

#5 @jcastaneda
5 years ago

I would second wontfix.

It returns an array that you can modify to your choosing.

$links = paginate_link( array( 'type' => 'array' ) );
foreach( $links as $link ){
    echo '<span class="item">' . $link . '</span>';
}
// or alternaticvely
$nav = '<ul class="page-nav"><li> . join( '</li><li class="link-item">', $links ) . '</li></ul>';

#6 @chriscct7
4 years ago

  • Milestone Future Release deleted
  • Resolution set to wontfix
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.