[solved]CGBlog sort by 'cgblog_extra' and then by descending

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
Evoken
Forum Members
Forum Members
Posts: 17
Joined: Thu Mar 03, 2011 6:06 pm

[solved]CGBlog sort by 'cgblog_extra' and then by descending

Post by Evoken »

Is there a way to first sort articles by the extra field and then by the descending date? I have several snippets like this on the site:

Code: Select all

{CGBlog category='Mercado' number='1' summarytemplate='summary_quarter' sortby='cgblog_extra'}
This is done so that by putting '1' into the extra field the article is diplayed on the homepage as a featured article (can't use a separate category for it for several reasons).

The issue with this is that the module sorts the articles by the extra field and then by the ascending date. So when two articles have 1 in the extra field, the module shows the oldest one as oppsoed to the newest. I've tried using 'sortorder=desc' or 'sortasc=false' and it doesn't works. In the module options I have Default Sorting set to Article Date and Default Sortorder set to Descending.

Any help is appreciated, versions I am using...

CMSMS 1.11.8
CGBlog 1.10.3
Last edited by Evoken on Mon Mar 31, 2014 6:48 pm, edited 1 time in total.
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3497
Joined: Mon Nov 28, 2011 9:29 am

Re: CGBlog sort by 'cgblog_extra' and then by descending dat

Post by velden »

Not solution but work around:

Remove the number parameter, remove the sortby parameter.

In your CGBlog summary template for the homepage:

Check for value 1 in extra field. Only if you find it, show the article and then break the foreach loop.

Not as efficient as proper sorting and number parameter but it should work.
Evoken
Forum Members
Forum Members
Posts: 17
Joined: Thu Mar 03, 2011 6:06 pm

Re: CGBlog sort by 'cgblog_extra' and then by descending dat

Post by Evoken »

Thanks velden!
I did it as you suggested and it worked nicely.
Post Reply

Return to “Modules/Add-Ons”