what theme are you using?
how are you trying to set the category post order?
Thread Starter
lkhlc
(@lkhlc)
custom theme:
<?php
query_posts($query_string . "&order=ASC"); ?>
<?php while ( have_posts() ) : the_post(); ?>
and many variations of query posts, wp query etc
try using an added action based on 'pre_get_posts'
–
http://codex.wordpress.org/Plugin_API/Action_Reference/pre_get_posts
example code (for instance to be added into functions.php of your theme):
add_action( 'pre_get_posts', 'category_sort_order' );
function category_sort_order( $query ) {
if ( is_admin() || ! $query->is_main_query() )
return;
if ( is_category() ) {
// reverse sort order for category archives
$query->set( 'order', 'ASC' );
return;
}
}
‘ASC’ will show the oldest post at the top of the list.
Thread Starter
lkhlc
(@lkhlc)
thank you.. tried it.. no result… so i change
// reverse sort order for category archives
$query->set( ‘orderby’, ‘title’ );
just to check if it was working and it was working.. nicely… by title.. but no other change made to it will effect the order for date…
then tried
$query->set( ‘orderby’, ‘rand’ );
and it worked nicely as well, but no reaction takes place with order as ASC or DESC using the date….
am stumped…
Thread Starter
lkhlc
(@lkhlc)
here is the blog category template being used (wp_pagenavi has been removed and returned checking for conflicts and there were none)
<?php
/**
* The template for displaying the BLOG Category.
* @package WordPress
* @subpackage Twenty_Eleven modified
* @since Twenty Eleven 1.0
* Compliant with 3.8.3
*/
get_header(); ?>
<?php if ( have_posts() ) : ?>
<div class="colmask rightmenu">
<div class="colleft" >
<div class="col1 c92p">
<!-- Column 1 start -->
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<div id="cat-post-content" class="cpc">
<?php while ( have_posts() ) : the_post(); ?>
<h1 class="entry-title blog-title"><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyeleven' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark" ><?php the_title(); ?></a> (<?php the_time('F j, Y'); ?>)<a href="<?php echo the_permalink();?>" title="<?php echo the_title(); ?>"><img border=0 align=right src="<?php echo get_template_directory_uri(); ?>/images/readall.png" class="readall"></a></h1>
<div class="entry-content ecc">
<?php if (catch_that_image()){ ?><a href="<?php echo the_permalink();?>" title="<?php echo the_title(); ?>"><img border=0 class="ctii" src="<?php echo catch_that_image() ?>" align=left></a><?php } ?>
<?php
$excerpt1 = get_the_content();
$excerpt1 = preg_replace('/<img[^>]+./','',$excerpt1);
$excerpt1 = strip_tags($excerpt1);
echo string_limit_words($excerpt1,88) . "... <a href='" . get_permalink() ."' title='" . get_the_title() . "' class='ctiimore'><i>MORE >></i></a>";
?>
<?php wp_link_pages( array( 'before' => '<div class="page-link"><span>' . __( 'Pages:', 'twentyeleven' ) . '[1]</span>', 'after' => '</div>' ) ); ?>
</div><!-- .entry-content -->
<?php endwhile; ?>
</article><!-- #post-<?php the_ID(); ?> -->
</div>
</div>
<?php endif; ?>
<style>
.wp-pagenavi a, .wp-pagenavi span {color:#444444;}
</style>
<div class="wpnb">
<?php wp_pagenavi(); ?>
</div>
<!-- Column 1 end -->
</div></div></div>
<?php get_footer(); ?>