Wordpress Themes - WP Forum at BFA
Click here to register or to donate.
Auto self-registration is not available here - far too many spammers. This forum has many, many backlinks and because of that there is an intense desire among spammers to drop their links here.

Wordpress Themes - WP Forum at BFA » WordPress Themes » Atahualpa 3 Wordpress theme » Center area post/pages » Excerpts, Read more, Pagination »

[SOLVED] Order Posts by Modified Date

Old Aug 20, 2009, 04:00 AM
3 posts · Aug 2009
Hi guys,

I'm hoping someone can point me in the right direction for editing the loop in the Atahualpa theme

I'd like to order ALL the posts on my blog - www.ddwt.co.uk - by date modified order, but can't find the relevant code in the loop (or the loop for that matter!) to add the 'orderby=modified' code to.

I'm using WP 2.8.4 and Atahualpa 3.4.1

Can someone help me please?

Thank you
Old Aug 20, 2009, 05:55 AM
juggledad's Avatar
23,761 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
The code you are looking for is in the WordPress base code. While Atahualpa does set up some of the SQL selects (populat posts, popular in category), it relies on the normal 'loop' code in WordPress to retrieve posts.

You will have to look into the Wordpress code - you can search for 'FROM $wpdb->posts' - to find the code that does the select and change the 'order by'.

You also might try looking to see if there is a plugin that which will change the order
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
Old Aug 20, 2009, 07:17 AM
3 posts · Aug 2009
Hi Juggledad,

Thanks for the prompt reply

I tried as you suggested, but couldn't find the 'FROM $wpdb->posts' string anywhere unfortunately.

Isn't there any way of doctoring this bit:

PHP Code:
<?php /* The LOOP starts here. Do this for all posts: */
while (have_posts()) : the_post(); $bfa_ata['postcount']++; ?>
So that it can include something like:

PHP Code:
<?php if (have_posts()) { $posts query_posts($query_string '&orderby=modified&order=desc'); } ?>
I'm very much a WP and PHP newbie, so could be talking out of my backside
Old Aug 21, 2009, 02:36 PM
3 posts · Aug 2009
Yay - I finally got it to work

So just for the sake of completeness, here's the solution (to my original request). Simply place this code:

PHP Code:
<?php query_posts($query_string '&orderby=modified&order=desc'); ?>
BEFORE this code in the MAIN index.php file (which you can edit directly via Wordpress):

PHP Code:
<?php /* If there are any posts: */
if (have_posts()) : $bfa_ata['postcount'] == 0/* Postcount needed for option "XX first posts full posts, rest excerpts" */ ?>
Hope it helps someone else


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
Thread Thread Starter Forum Replies Last Post
my-category-order plugin order by 'order' not working darrenk Page & Category Menu Bars 3 Mar 24, 2010 07:56 AM
Posts display in reverse order? WayneEarl Installing & running WordPress 1 Aug 10, 2009 05:38 AM
The order of the header's rows and... ahc Header configuration & styling 2 Jun 2, 2009 03:54 PM
Pages Order in Sidebar gradlebum Atahualpa 3 Wordpress theme 3 May 29, 2009 04:07 PM
The %date-modified('F jS, Y')% in post footer not working Glottis Post-Kicker, -Byline & -Footer 11 Apr 11, 2009 05:52 AM

All times are GMT -6. The time now is 06:17 PM.

Powered by vBulletin® Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.