Viewing 9 replies - 1 through 9 (of 9 total)
  • Could you be a bit more specific?

    Make one of the pages a non paginated version of the content.

    Thread Starter gulliver

    (@gulliver)

    Thanks.

    On the ‘Could you be a bit more specific?’ reply: currently there’s ‘Page 1 2 3…’ links; I’d like to have ‘Page 1 2 3… all’.

    On ‘Make one of the pages a non paginated version of the content.’… I’m not sure I fully understand, but doesn’t that require me to add the entire post content after the last page-break? Or have I misunderstood?

    Moderator keesiemeijer

    (@keesiemeijer)

    thanks for that keesiemeijer, pretty slick.
    Not knowing how to do that, yse, I would make one of the pagss a full version. Probably the last page. I would probably hard code a link to it as well with a button that said “See entire article on one page”

    Moderator keesiemeijer

    (@keesiemeijer)

    For example you have a (very simplified) loop like this in your theme’s single.php:

    <?php while ( have_posts() ) : the_post(); ?>
    
    					<?php the_content(); ?>
    
    					<?php wp_link_pages(); ?>
    
    				<?php endwhile; // end of the loop. ?>

    You would change it like this to add the “See entire article on one page” after the numbered page links:

    <?php
    	$no_pagination = false;
    	global $wp_query;
    		if (isset($wp_query->query_vars['all'])) {
    			$no_pagination = $wp_query->query_vars['all'];
    	}
    ?>
    				<?php while ( have_posts() ) : the_post(); ?>
    
    					<?php
    					if($no_pagination) {
    					  echo apply_filters('the_content',$post->post_content);
    					  $page=$numpages+1;
    					} else {
    					  the_content('');
    					}
    					?>
    
    					<?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"> See entire article on one page</a></p>',$page_links);
    					echo $page_links;
    					?>
    
    				<?php endwhile; // end of the loop. ?>

    And put this in your theme’s functions:

    add_filter('query_vars', 'parameter_queryvars' );
    function parameter_queryvars( $qvars )
    {
    $qvars[] = 'all';
    return $qvars;
    }

    very cool

    Thread Starter gulliver

    (@gulliver)

    Thanks, everybody.

    Thread Starter gulliver

    (@gulliver)

    UPDATE…

    I have a small problem with this, as it seems to change the link behavior.

    (This may just be a problem with my theme, but I don’t know.)

    When viewing the post as a single page, I’d expect/prefer to have the ‘view as single page’ text unlinked – in the same way that when viewing a specific page, its number in wp_link_pages is unlinked.

    The ‘Page-Links Plus: Single Page’ plugin handles this ok, but I prefer to avoid plugins where possible.

    I have another issue – probably caused by me trying to be to clever with stuff I really don’t understand.

    To also provide more prominent previous/next links, I use wp_link_pages twice – once to show just the previous/next links right after the preceding paragraph, and again at the foot of the post to show the pages numbers.

    When viewing as a single page, a ‘previous’ link is still shown. Presumably this can be removed with some conditional statement, but I’ve no idea how. (And, this breaks when using the previously-mentioned plugin – it tries to link to a non-existent -1 page.)

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Show entire post when paginated’ is closed to new replies.