Support » Plugin: List category posts » Sort by more than one field?

  • Hi – I’m on a tight deadline so would be REALLY happy if someone can help with either a fix or workaround (and I’d very much rather not hack this by changing the post dates!)…

    I need to sort a blog list by two fields, ideally first a custom field (desc) then, within that, by date (desc). Since there’s only one orderby parameter, I’m guessing both HAVE to sort sort ‘desc’ – but can it excecute the custom sort, THEN the date one… however I’m guessing the parameter order in the shortcode is irrelevant, so even if it could read both, how would it know which to do first…?

    Here’s what I tried (though the orderby= doesn’t do anything!) – I’ve left in my troubleshooting reveals, but added new lines and removed all the tag and class definitions to make it easier to read:

    [catlist
    name="jb-ttef"
    numberposts=100
    date=yes
    author=yes
    author_posts_link=yes
    excerpt=full
    excerpt_size=50
    posts_morelink="Read more ›"
    thumbnail=yes
    customfield_display=blog_post_custom_sort
    customfield_display_name=no
    customfield_orderby=blog_post_custom_sort
    orderby=date
    order=desc
    display_id=yes
    ]
    
    Intended result:
    
    Post name	 blog_post_custom_sort	date created
    testing			0100		17/3/19
    more testing		0002		20/3/19
    testing again		0002		15/3/19
    another one		0002		10/3/19
    still testing		0001		25/3/19
    
    (as in shortcode above, I've already filtered by category)

    I was hoping that the date sort might be default and, if several posts have the same value in the custom field, this behaviour would just drop out naturally, but sadly not – the sorting WITHIN a given value for the custom field looks random, though there’s no doubt a logic I haven’t spotted yet! it’s not date and not ID.

    Is there any way to achieve this (without much hacking – I’m on a very tight deadline on this one!!)?

    Many thanks! 🙂

    • This topic was modified 2 months, 3 weeks ago by  wwwolf.
Viewing 1 replies (of 1 total)
  • I got errors (a 404) when I edited this, and although it seems to exist, it has lost all its tags (and won’t let me put them back) – sorry…

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.