Support » Fixing WordPress » Link to show entire paginated post on one page?

  • I use post pagination to break up long articles but I’d like to give my readers the option to view all the pages of the article on one single page.

    So just to be clear I would still be using the <!--nextpage--> tag to break the article up into several pages but there would be a link in the post tools section where the reader could click and “View on one page” all the articles pages.

    How would I accomplish this?


Viewing 3 replies - 1 through 3 (of 3 total)
  • Same question here, Matt. I’ll let you know if I find a solution. In my case, I’m trying to do so for a print and PDF version of a page.



    Forum Moderator

    interesting idea.

    took a few steps to do it:

    1. let wordpress use a parameter in the url:
    thanks to this article:
    – add this to functions.php of the theme:

    /* pass Parameter with url
    Plugin URI:
    Description: A plugin to allow parameters to be passed in the URL and recognized by WordPress
    Author: Adam Boyse
    Version: 1.0
    Author URI:
    add_filter('query_vars', 'parameter_queryvars' );
    function parameter_queryvars( $qvars )
    $qvars[] = 'all';
    return $qvars;

    2. use this parameter to switch to full post content:
    – to show the full content despite the <!--nextpage--> tags, you would use:
    echo apply_filters('the_content',$post->post_content);
    instead of the_content();

    – use the paramter from the url to recognize if the full post is to be shown:

    global $wp_query;
    if (isset($wp_query->query_vars['all']))
    { $no_pagination = $wp_query->query_vars['all']; } ;

    – show the full post or the paginated parts, dependant on the variable:
    if($no_pagination) { echo apply_filters('the_content',$post->post_content); $page=$numpages+1; } else { the_content(''); };

    ($page=$numpages+1; tricks ‘wp_link_pages’ to show all links.)

    3. change the ‘wp_link_pages’ to include a ‘all’ choice:

    <?php $page_links = wp_link_pages(array('before' => '<p><strong>Pages:</strong> ', 'after' => '</p>', 'next_or_number' => 'number', 'echo' => '0' ));
    $page_links = str_replace('</p>','<a href="'.get_permalink().'?all=1"> all</a></p>',$page_links); echo $page_links; ?>

    hope this helps, good luck 😉

    That worked great. Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Link to show entire paginated post on one page?’ is closed to new replies.