Not sure what part of that will help.
The problem is the
<?php query_posts('category_name=news,news&showposts=5&paged=1'); ?>
When I just have
<?php while ( have_posts() ) : the_post() ?>
Without trying to display a specific category, it works fine
a:
‘category_name’ only takes one category slug as parameter; http://codex.wordpress.org/Class_Reference/WP_Query#Category_Parameters
b:
use of ‘paged’: http://codex.wordpress.org/Class_Reference/WP_Query#Pagination_Parameters
c:
‘showposts’ is deprecated; use ‘posts_per_page’; http://codex.wordpress.org/Class_Reference/WP_Query#Pagination_Parameters
i.e. try:
<?php query_posts('category_name=news&posts_per_page=5&paged='.get_query_var('page')); ?>
Thanks for the help from both of you. I have updated with that code, but I am still having the issue. Here is where I am at now
<?php query_posts('category_name=news&posts_per_page=5&paged='.get_query_var('page')); ?>
<?php while ( have_posts() ) : the_post() ?>
<?php /* Create a div with a unique ID thanks to the_ID() and semantic classes with post_class() */ ?>
<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<?php /* an h2 title */ ?>
<h2 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php printf( __('Permalink to %s', 'hbd-theme'), the_title_attribute('echo=0') ); ?> " rel="bookmark"><?php the_title(); ?> »</a></h2>
<?php /* The entry content */ ?>
<div class="entry-content">
<?php echo content(100); ?>
<?php wp_link_pages('before=<div class="page-link">' . __( 'Pages:', 'hbd-theme' ) . '&after=</div>') ?>
</div><!-- .entry-content -->
</div><!-- #post-<?php the_ID(); ?> -->
<?php /* Close up the post div and then end the loop with endwhile */ ?>
<?php endwhile; ?>
<?php /* Bottom post navigation */ ?>
<?php global $wp_query; $total_pages = $wp_query->max_num_pages; if ( $total_pages > 1 ) { ?>
<div id="nav-below" class="navigation">
<?php next_posts_link(__( '<span class="meta-nav">«</span> Older posts', 'hbd-theme' )) ?> <?php previous_posts_link(__( 'Newer posts <span class="meta-nav">»</span>', 'hbd-theme' )) ?>
</div><!-- #nav-below -->
<?php } ?>
When I click the more posts button, It still displays the same posts but it only happens when I query posts within the “news” category. If I don’t use that category, I don’t run into the issue.
Thanks for the help!
alternatively try:
<?php query_posts('category_name=news&posts_per_page=5&paged='.get_query_var('paged')); ?>
It worked! Thank you so much alchymyth.
hi alchymyth
it’s not working at my web page. my code is that:
<?php
global $myOffset;
$myOffset = 0;
$temp = $wp_query;
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
//echo 'SINGLEPOST:';
$singlePost = get_query_var('singlePost');
$wp_query= null;
$wp_query = new WP_Query();
$wp_query->query(array(
'paged' => $paged,
'offset' => $myOffset,
'category__not_in' => array($ar_headline,$ar_featured),
'post__not_in' => get_option( 'sticky_posts' ),
'ignore_sticky_posts' => 1,
'post_type' => !$singlePost ? array('post','haberler','otopsiler') : array('post'),
));
?>
Any ideas? Thanks
what exactly is not working?
what is the value of $singlePost = get_query_var('singlePost'); ?
have you tried to remove this line from the query: 'offset' => $myOffset,
what is the content of $ar_headline and $ar_featured in this line:
'category__not_in' => array($ar_headline,$ar_featured), ?
if those are both arrays, you might nned to use:
'category__not_in' => array_merge($ar_headline,$ar_featured),
if the posted code is only part of a template, please provide the full template code – use the pastebin – http://codex.wordpress.org/Forum_Welcome#Posting_Code
can you provide a link to your site to illustrate the problem?
my web page
I’ve tried all of these applications but page 3 and 4,5,6…. aren’t working. theme name is arthemia.
full template code (index.php)
<?php get_header(); ?>
<?php
//Get value from Admin Panel
$cp_categories = get_categories('hide_empty=0');
$status1 = get_option( "colabs_preventHeadline" );
if ( $status1 != "No" ) {
$ar_headline = get_option( "colabs_headline" );
$ar_featured = get_option( "colabs_featured" );
}
?>
<div id="bottom" class="clearfloat">
<div class="<?php if(get_option('colabs_layout_settings')=='two-col-right'){echo 'right';}else{?>left<?php }?>">
<?php if(!is_paged() && 1 == 2) { ?>
<div id="front-list">
<?php
$args = array(
'category__not_in' => array($ar_headline,$ar_featured),
'showposts' => 1,
);
query_posts($args); ?>
<?php while (have_posts()) : the_post(); ?>
<?php global $ar_ID; global $post; $ar_ID[] = $post->ID; ?>
<div class="clearfloat">
<h3 class="cat_title"><?php the_category(', '); ?> »</h3>
<h2 class="title"><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h2>
<?php colabs_post_meta(); ?>
<?php
$latest_thumb=get_option('colabs_latest_post_thumb');
if($latest_thumb!='No'){
$width = get_option ( "colabs_thumbWidth_LatestPost" );
$height = get_option ( "colabs_thumbHeight_LatestPost" );
if ( $width == 0 ) { $width = 150; }
if ( $height == 0 ) { $height = 150; }
colabs_pp('width='.$width.'&height='.$height.'&size=medium-thumb&play=true&wrapper_class=left&link=img');
}
?>
<?php //the_content(__('Read the full story »','colabsthemes')); ?>
<?php the_excerpt(); ?>
</div>
<?php endwhile; ?>
<?php wp_reset_query(); ?>
</div><!--/#front-list-->
<?php } ?>
<?php add_filter('post_limits', 'my_post_limit'); ?>
<?php
global $myOffset;
$myOffset = 0;
$temp = $wp_query;
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
//echo 'SINGLEPOST:';
$singlePost = get_query_var('singlePost');
$wp_query= null;
$wp_query = new WP_Query();
$wp_query->query(array(
'paged' => $paged,
'offset' => $myOffset,
'category__not_in' => array($ar_headline,$ar_featured),
'post__not_in' => get_option( 'sticky_posts' ),
'ignore_sticky_posts' => 1,
'post_type' => !$singlePost ? array('post','haberler','otopsiler') : array('post'),
));
?>
<?php $column = get_option ( "colabs_status_Column" );
if ( $column != "one" ) { ?>
<div id="paged-list">
<?php if (have_posts()) : ?>
<?php $i = 1; ?>
<?php while ($wp_query->have_posts()) : $wp_query->the_post(); ?>
<?php global $ar_ID; global $post; $ar_ID[] = $post->ID; ?>
<?php if( $odd = $i%2 ) { echo '<div class="clearfloat">'; } ?>
<div class="tanbox <?php if( $odd = $i%2 ) { echo 'left'; } else { echo 'right'; } ?>">
<h3 class="title"><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></a></h3>
<?php
colabs_post_meta();
$width = get_option ( "colabs_thumbWidth_Column" );
$height = get_option ( "colabs_thumbHeight_Column" );
if ( $width == 0 ) { $width = 80; }
if ( $height == 0 ) { $height = 80; }
colabs_pp('width='.$width.'&height='.$height.'&size=small-thumb&play=true&wrapper_class=left&link=img');
?>
<?php $status = get_option ( "colabs_excerptColumn" ); if ( $status != "no" ) { ?>
<?php the_excerpt(); ?>
<?php } ?>
</div>
<?php if( $odd = $i%2 ) { } else { echo '</div>'; } ?>
<?php $i++; endwhile; ?>
<?php if( $odd = $i%2 ) { } else { echo '</div>'; } ?>
<div id="navigation">
<?php if(function_exists('wp_pagenavi')) { wp_pagenavi(); } ?>
</div>
<?php endif; ?>
</div><!--/#paged-list-->
<?php } else { ?>
<div id="paged-list">
<?php if (have_posts()) : ?>
<?php while ($wp_query->have_posts()) : $wp_query->the_post(); ?>
<?php global $ar_ID; global $post; $ar_ID[] = $post->ID; ?>
<div class="onecolumn clearfloat">
<h3 class="title"><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></a></h3>
<?php
colabs_post_meta();
echo "<!-- /HEREEEEEEE -->";
$width = get_option ( "colabs_thumbWidth_Column" );
$height = get_option ( "colabs_thumbHeight_Column" );
if ( $width == 0 ) { $width = 80; }
if ( $height == 0 ) { $height = 80; }
colabs_pp('width='.$width.'&height='.$height.'&size=small-thumb&play=true&wrapper_class=left&link=img');
?>
<?php $status = get_option ( "colabs_excerptColumn" ); if ( $status != "no" ) { ?>
<?php the_excerpt(); ?>
<?php } ?>
</div>
<?php endwhile; ?>
<div id="navigation">
<?php if(function_exists('wp_pagenavi')) { wp_pagenavi(); } ?></div>
<?php endif; ?>
</div><!--/#paged-list-->
<?php } ?>
<?php $wp_query = null; $wp_query = $temp;?>
<?php remove_filter('post_limits', 'my_post_limit'); ?>
</div><!--/#bottom-left-->
<div id="sidebar" class="<?php if(get_option('colabs_layout_settings')=='two-col-right'){echo 'left';}else{?>right<?php }?>">
<?php get_sidebar(); ?>
</div><!--/#bottom-->
<?php get_footer(); ?>
thanks
what is the code of the ‘my_post_limit()’ function, which gets called in here:
<?php add_filter('post_limits', 'my_post_limit'); ?>
pagination can make problems if the ‘posts_per_page’ is different from what is set under dashboard – settings – reading.
as the problem could be related to the ‘wp-pagenavi’ plugin, consider to start a new topic under http://wordpress.org/support/plugin/wp-pagenavi – scroll down to the bottom for a topic form.
thanks for reply. i have tried all of numbers(from 1 to 10) at settings – reading but it isn’t working.