You do not have a $paged variable. Try:
<?php
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$wp_query = new WP_Query();
$wp_query->query('cat=-5&showposts=4'.'&paged='.$paged);
?>
still not working can there be anything else? can you check blogressive theme?
There are literally thousands of WordPress themes – which means that many people won’t be familiar with your particular theme. So a link to your site where people can see the theme might result in more responses.
Try query_posts instead of wp_query as following:
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$args = array(
'cat' => 5,
'posts_per_page' => 4,
'paged' => $paged
);
query_posts( $args );
if ( have_posts() ) {
while ( have_posts() ) {
the_post();
// post content
}
// Paging code
}
get this error: Parse error: syntax error, unexpected T_STRING
with above code
Remove If condition from my code, write as follows:
<?php
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$args = array(
'cat' => 5,
'posts_per_page' => 4,
'paged' => $paged
);
query_posts( $args );
while ( have_posts() ) : the_post();
//Post Content
endwhile;
// Paging
next_posts_link('← Older Entries');
previous_posts_link('Newer Entries →');
?>
sorry it was a div missing, fixed thank you for the code from both.
Please mark the issue as resolved.
<?php
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$args = array(
'cat' => 5,
'posts_per_page' => 4,
'paged' => $paged
);
query_posts( $args );
while ( have_posts() ) : the_post();
//Post Content
endwhile;
// Paging
next_posts_link('← Older Entries');
previous_posts_link('Newer Entries →');
?>
to get the code working for me, I first have to change the first row with
<?php
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
to
<?php
$paged = (get_query_var('page')) ? get_query_var('page') : 1;
(the term paged changed to page) and this seems to be legit referring to this last comment on Pagination Parameter saying:
You should set get_query_var( ‘page’ ); if you want your query to work with pagination. Since WordPress 3.0.2, you do get_query_var( ‘page’ ) instead of get_query_var( ‘paged’ ). The pagination parameter ‘paged’ for WP_Query() remains the same.
haven’t seen anyone highlighting this when discussion the same problem, are many people using elder versions of WP or what?
@haselovic
haven’t seen anyone highlighting this when discussion the same problem, are many people using elder versions of WP or what?
I think the codex is wrong there.
I think you should use get_query_var('page')
on a single Post or Page (template) that has been divided into pages using the <!–nextpage–> QuickTag.
And also on a static front page (template) that has a query on the loop. On all other template files you should use “paged”.
Did you change it to “page” on a static front page (page template)?
If not, on what theme template file did you have to change it to “page”?