This website can use cookies to improve the user experience

This website can use cookies to improve the user experience and to provide certain services and functions to users. Cookies contain small amounts of information (such as login information and user preferences) and will be stored on your device.

Enable All Cookies Privacy Policy

Individual Channel Articles Sorting?


avatar
ReviewStud 135
From: -
Individual Channel Articles Sorting?

How can I sort only the articles in my "news" channel by the date they were posted? Newest articles on top then older articles below.

The rest of my channels are already sorted alphabetically.

Notice

This topic is archived. New comments cannot be posted and votes cannot be cast.

Responses to this topic


1 Re: Individual Channel Articles Sorting?
avatar
Editor
0
From: -
There is a small typo: It is $key == "1a1a1a1a" not $key = "1a1a1a1a"
1 Re: Individual Channel Articles Sorting?
avatar
OP 135
From: -
It looks like to new code worked. The news articles are being sorted by their posting date, but now every channel/page is displaying the same articles from the "news" channel.
1 Re: Individual Channel Articles Sorting?
avatar
Editor
0
From: -
Open /modules/news/newschannels.php in an editor and replace:

          $query = $database -> dbquery( "SELECT newsstory_id, newsstory_author, newsstory_channels, newsstory_title, newsstory_seo, newsstory_story, newsstory_extendedstory, newsstory_link, newsstory_tags, newsstory_teaser, newsstory_comments, newsstory_thread, newsstory_date, newsstory_fields, newsstory_views, newsstory_rating, newsstory_votes, newsstory_source, newsstory_sourceid FROM " . DB_PREFIX . "esselbach_ct_newsstories WHERE newsstory_channels LIKE ('%" . $key . "%') AND " . $newsstory_status . " AND (newsstory_website = '0' OR newsstory_website = '" . $preferences[ 'current_website' ] . "')" . $news_expire_sql . " ORDER BY newsstory_id DESC LIMIT " . intval( $stories ) );


with:

                if ( $key = "1a1a1a1a" )

{
$query = $database -> dbquery( "SELECT newsstory_id, newsstory_author, newsstory_channels, newsstory_title, newsstory_seo, newsstory_story, newsstory_extendedstory, newsstory_link, newsstory_tags, newsstory_teaser, newsstory_comments, newsstory_thread, newsstory_date, newsstory_fields, newsstory_views, newsstory_rating, newsstory_votes, newsstory_source, newsstory_sourceid FROM " . DB_PREFIX . "esselbach_ct_newsstories WHERE newsstory_channels LIKE ('%" . $key . "%') AND " . $newsstory_status . " AND (newsstory_website = '0' OR newsstory_website = '" . $preferences[ 'current_website' ] . "')" . $news_expire_sql . " ORDER BY newsstory_date DESC LIMIT " . intval( $stories ) );

}
else
{
$query = $database -> dbquery( "SELECT newsstory_id, newsstory_author, newsstory_channels, newsstory_title, newsstory_seo, newsstory_story, newsstory_extendedstory, newsstory_link, newsstory_tags, newsstory_teaser, newsstory_comments, newsstory_thread, newsstory_date, newsstory_fields, newsstory_views, newsstory_rating, newsstory_votes, newsstory_source, newsstory_sourceid FROM " . DB_PREFIX . "esselbach_ct_newsstories WHERE newsstory_channels LIKE ('%" . $key . "%') AND " . $newsstory_status . " AND (newsstory_website = '0' OR newsstory_website = '" . $preferences[ 'current_website' ] . "')" . $news_expire_sql . " ORDER BY newsstory_title LIMIT " . intval( $stories ) );
}


You need to replace the key 1a1a1a1a in the first line with the actual key of your news channel. You find the key in the table esselbach_ct_newschannels

Notice

This topic is archived. New comments cannot be posted and votes cannot be cast.