How to Order categories by most recently updated
-
I have a problem with my wordpress blog .. I use version 4.0
I want to sort categories by most recently updated
example:
I have 3 categories: Cat 1, Cat 2, Cat 3Let’s say that I have posted first in Cat 1 after this In Cat 3 and the last post in Cat 2
I want that the order of category list to be like this:
Cat2
Cat3
Cat1this is my custom code used in template:
<?php $categories = get_categories($cat_args); foreach($categories as $category) { echo '<a href="' . get_category_link( $category->term_id ) . '" title="' . sprintf( __( "View all videos in %s" ), $category->name ) . '" ' . '><div class="postbox">'; echo '<h3>' . $category->name.'</h3>'; $post_args = array( 'numberposts' => 1, 'category' => $category->term_id ); $posts = get_posts($post_args); foreach($posts as $post) { ?> <div class="boxentry"> <?php $thumb = vid_custom('thumb_url',get_the_ID()); if(!empty($thumb)) { ?> <img src="<?php echo $thumb; ?>" alt="<?php the_title_attribute(); ?>" width="180" height="140" class="thumb"/> <?php } else { ?> <img src="<?php bloginfo('template_url') ?>/images/pic_post1.jpg" width="180" height="140" alt="image" class="thumb"/><?php } ?> </div> <?php ?> <?php } echo '<em>View All Videos ('.$category->count.')</em>'; echo '</div></a>'; } ?>Does anyone have any solution for this?
Thank you in advance!
-
I’m sorry but we cannot provide accurate answers to any blogger who fails to provide the exact URL starting with http:// for the exact blog they refer to so we can verify where it is hosted. Please do that now.
Also know that we don’t provide support for any blogs other than those hosted by WordPress.COM and my guess is that your site is not one of them.
WordPress.com and WordPress.org are completely separate and have different logins, features, run different versions of some themes with the same names, and have separate support forums. http://support.wordpress.com/com-vs-org/
If you don’t have a username account at WordPress.ORG click http://wordpress.org/support/ and register one on the top right hand corner of the page that opens, so you can post to the support forums there and receive advice from WordPress.ORG bloggers.
Resetting your WordPress.ORG password http://codex.wordpress.org/Resetting_Your_Password
- The topic ‘How to Order categories by most recently updated’ is closed to new replies.