Hi,

probably very easy to do but I can't find where and searching this forum isn't really a help, sorry to mention guys from Drupal but that's what I reckon. Very difficult to find a post - that has the exact words in the title - at the top of the resulst list.. anyway.. still work to do I guess.

so here it is: Where can I change the order for my teasers in the frontpage? I've seen it before but can't find it anymore. Now they are in descending order and I want them in ascending order. That's possible right?

cheerio,

BassPlaya.

Comments

BassPlaya’s picture

Hey guys,

I really can't find where to do this.
Is there anybody out there who knows or can push me into the right direction?

Authentically,
BassPlaya

BassPlaya’s picture

okay, I've found out that this function exists in the comments settings page. I knew I've seen it somewhere.
Anybody knows how to to do the same in the story settings so the teasers get published in a descending order on the front page?

Authentically,
BassPlaya

MarcDo’s picture

Hi,

My way of changing the order on the main page, was changing the query used in node.module in the function node_page_default:

/**
 * Generate a listing of promoted nodes.
 */
function node_page_default() {
    //$result = pager_query(db_rewrite_sql('SELECT n.nid, n.sticky, n.created FROM {node} n WHERE n.promote = 1 AND n.status = 1 ORDER BY n.sticky DESC, n.created DESC'), variable_get('default_nodes_main', 10));    
    // MOD
	$result = pager_query(
	    db_rewrite_sql('SELECT n.nid, n.sticky, ifnull(e.event_start, UNIX_TIMESTAMP(now()) - n.created + UNIX_TIMESTAMP()) as created FROM {node} n
    	 	LEFT JOIN event e ON n.nid = e.nid
     		WHERE n.promote = 1 AND n.status = 1
	     	ORDER BY n.sticky DESC, created ASC'), variable_get('default_nodes_main', 10));

For me this changed the order for the event nodes in ascending order.
For you the change would only be: n.created ASC

BTW this is for 4.7

Hope this works,
Marc

BassPlaya’s picture

WOW !!

it works !! and it was only modifying 3 letters, as you said: "ASC" !!
I'm not really a specialist in php.
yes, still running on 4.7.x. too.

much appreciated.

Cheers Marc !!

Authentically,
BassPlaya