You appear to be a bot. Output may be restricted
Description
Paginate links for shortcode paginationUse paginate_links() to create special pagination links for shortcodes These work independently of WordPress pagination, which uses "page". When the user is visiting the page,
- since each shortcode produces its own shortcode ID ( bwscid$id ),
- then the URL will slowly build up the pagination information for each shortcode.
- This avoids the need for cookies and/or jQuery to remember the page state of each shortcode.
Usage
bw_navi_paginate_links( $id, $page, $pages );
Parameters
- $id
- ( integer ) required – the 'unique' shortcode ID for this instance of a paged shortcode
- $page
- ( integer ) required – the current page number ( starts from 1 )
- $pages
- ( integer ) required – the total number of pages
Returns
voidSource
File name: oik/shortcodes/oik-navi.phpLines:
1 to 39 of 39
function bw_navi_paginate_links( $id, $page, $pages ) { //bw_trace2( $_SERVER['REQUEST_URI'], "request_URI" ); $saved_request_uri = $_SERVER['REQUEST_URI']; $string = remove_query_arg( "bwscid$id" ); $_SERVER['REQUEST_URI'] = $string; //bw_trace2( $string, "removed request_URI", false ); $base = add_query_arg( "bwscid$id", "%_%" ); //bw_trace2( $base, "base", false ); $base = esc_url_raw( $base ); //bw_trace2( $base, "base", false ); $format = "%#%"; $args = array( "base" => $base , "format" => $format , "total" => $pages , "current" => $page , "before_page_number" => "[" , "after_page_number" => "]" , "add_args" => false , "type" => "plain" ); // We don't need to worry about these yet // 'show_all' => false, // 'prev_next' => true, // 'prev_text' => __('� Previous'), // 'next_text' => __('Next �'), // 'end_size' => 1, // 'mid_size' => 2, // 'type' => 'plain', // 'add_args' => false, // array of query args to add // 'add_fragment' => '', $links = paginate_links( $args ); //bw_trace2( $args, "args" ); //bw_trace2( $links, "links", false ); sdiv( "page-numbers pagination"); e( $links ); ediv(); $_SERVER['REQUEST_URI'] = $saved_request_uri; }View on GitHub View on Trac