I'm trying to add an all pages link to posts when I have ?all=1 at the end of the URL it's returning "not set", I'm not sure what I'm doing wrong. I've looked here and my code is the same as here: http://codex.wordpress.org/Custom_Queries#Custom_Archives
functions.php
add_filter('query_vars', 'all_pages' );
function all_pages( $qvars ) {
$qvars[] = 'all';
return $qvars;
}
single.php
global $wp_query;
if (isset($wp_query->query_vars['all'])) {
$remove_pagination = $wp_query->query_vars['all'];
echo "all set";
} else { echo "not set"; };