I started thinking about this, and there is a completely template-based solution for it. First, change the_content()
tag:
<?php the_content(); ?>
to this:
<?php
if(isset($_GET['page']) && 'all' == $_GET['page']) {
$content = apply_filters('the_content', $post->post_content);
echo $content;
} else {
the_content();
}
?>
Make this change in the single.php template. If your theme doesn’t have one, make a copy of index.php and name it single.php. If you’d rather not use one, use index.php but alter the code to:
<?php
if(is_single() && isset($_GET['page']) && 'all' == $_GET['page']) {
$content = apply_filters('the_content', $post->post_content);
echo $content;
} else {
the_content();
}
?>
In summary this overrides any of the *tweaks* that are performed in get_the_content()
, including its parsing of <!--nextpage-->
for the purpose of pagination, but it still runs the regular text filters on your post’s content before displaying it. You can use any value for the page GET. I used “all” only because it’s in your example above.
All you need is the link… You’ll probably want to add it just after link_pages()
(or wp_link_pages()
) is called in the template. For custom permalinks, use:
<a href="<?php the_permalink(); ?>all/">display entire post</a>
(Can anyone verify that will *not* fail with custom permalinks?) And for default (query-type) permalinks:
<a href="<?php the_permalink(); ?>?page=all">display entire post</a>
Incorporating the link with the other page links would require editing the link_pages()
function found in template-functions-post.php (wp-includes/ directory).
EDIT: Checked myself, and the custom permalink example will fail (the mod_rewrite rules match againt 0-9, so no text value like ‘all’). Any chance 0
will work as the “all” value? Hmm…