get_pagenum_link example


function paginate_links( $args = '' ) {
    global $wp_query$wp_rewrite;

    // Setting up default values based on the current URL.     $pagenum_link = html_entity_decode( get_pagenum_link() );
    $url_parts    = explode( '?', $pagenum_link );

    // Get max pages and current page out of the current query, if available.     $total   = isset( $wp_query->max_num_pages ) ? $wp_query->max_num_pages : 1;
    $current = get_query_var( 'paged' ) ? (int) get_query_var( 'paged' ) : 1;

    // Append the format placeholder to the base URL.     $pagenum_link = trailingslashit( $url_parts[0] ) . '%_%';

    // URL base depends on permalink settings.     $format  = $wp_rewrite->using_index_permalinks() && ! strpos( $pagenum_link, 'index.php' ) ? 'index.php/' : '';
    
function get_next_posts_page_link( $max_page = 0 ) {
    global $paged;

    if ( ! is_single() ) {
        if ( ! $paged ) {
            $paged = 1;
        }

        $next_page = (int) $paged + 1;

        if ( ! $max_page || $max_page >= $next_page ) {
            return get_pagenum_link( $next_page );
        }
    }
}

/** * Displays or retrieves the next posts page link. * * @since 0.71 * * @param int $max_page Optional. Max pages. Default 0. * @param bool $display Optional. Whether to echo the link. Default true. * @return string|void The link URL for next posts page if `$display = false`. */
Home | Imprint | This part of the site doesn't use cookies.