[wp-trac] [WordPress Trac] #39631: Pagination prepareLinkPreview() Changesets Customizer
WordPress Trac
noreply at wordpress.org
Sat Feb 11 07:11:43 UTC 2017
#39631: Pagination prepareLinkPreview() Changesets Customizer
-------------------------------+-----------------------------------------
Reporter: nwp_developer | Owner:
Type: defect (bug) | Status: closed
Priority: normal | Milestone:
Component: Customize | Version: 4.7
Severity: normal | Resolution: invalid
Keywords: reporter-feedback | Focuses: javascript, administration
-------------------------------+-----------------------------------------
Changes (by westonruter):
* status: new => closed
* resolution: => invalid
* milestone: Awaiting Review =>
Comment:
@nwp_developer This doesn't seem to be a problem with the customizer but
rather is a problem with how you are using `get_pagenum_link()`. Since it
returns a URL which may have a query component, then to me it seems you
need to account for this in where you decide to inject `%_%`. Here's one
possible solution:
{{{#!php
<?php
$base = get_pagenum_link( 1, false );
$parsed_base_url = parse_url( $base );
$parsed_base_url['path'] .= '%_%';
$base_url = $parsed_base_url['scheme'] . '://' . $parsed_base_url['host']
. trailingslashit( $parsed_base_url['path'] );
if ( ! empty( $parsed_base_url['query'] ) ) {
$base_url .= '?' . $parsed_base_url['query'];
}
echo paginate_links( array(
'base' => $base_url,
'format' => 'page/%#%',
) );
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/39631#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list