Skip Navigation

[Resolved] Sorting news-items by category with dropdown but want most recent at the top of

This support ticket is created 5 years, 5 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 9 replies, has 2 voices.

Last updated by Luo Yang 5 years, 4 months ago.

Assisted by: Luo Yang.

Author
Posts
#1282339
News-by-Category-View.png

There is a news item that is displaying at the beginning of the news items that was first published in 2010 and should be the last one. The view is a custom search "News by Category" with a dropdown of categories. Selecting the categories seems to work but It's not sorting by post-date. Want to display most recent first.

hidden link

is at the top of "news" but should be last.

We just went into production so I haven't made a specific duplication of staging and am not concerned by that.

#1282715

Hello,

Thanks for the details, I can log into your website.

But I am not sure where and how can I see the problem, I have checked the URL you mentioned above, there isn't any post view.

I assume you are going to sort the view's result by taxonomy "category".

If it is, there isn't such a built-in feature within Views, since Views is using WordPress class WP_Query to query posts, see wordpress document:
https://codex.wordpress.org/Class_Reference/WP_Query#Order_.26_Orderby_Parameters
There isn't such an option to order the result by taxonomy.

And you can sort the result by post date "descending", so Views result will output the most recent items first.

For example, in your screenshot:
hidden link
in section "Ordering", choose: Order by Post date Descending

#1282791

Hello again, Luo. On the menu is “News & Ideas” and right at the top is the oldest item “hidden link. It seems no matter what change I make to the view that particular item shows up in the list. It is very odd.

The drop down sorts by category and we want newest first. I will try the post date descending if you will please check to see if something is wrong with that’l record.

#1282793

You can reproduce the issue by going to news & ideas and selecting “News”

1st in list is newest and 2nd in list is oldest. Sorting by post date descending...

#1282881

I assume we are talking about this page:
hidden link

And this post view "News by Category"
hidden link

I have tried these in your website:
1) Edit above post view, in section "Ordering", choose: Order by Post date Descending
2) In section "Loop Editor", add shortcode within loops:
[wpv-post-date]

Test it in front-end:
hidden link

I see the problem as you mentioned above, but this problem is abnormal, please check these:
1) In case it is a compatibility problem, please deactivate all other plugins, and switch to wordpress default theme 2019, deactivate all custom PHP/JS code snippets, and test again

2) Also check if there is any PHP/JS error in your website:
https://toolset.com/documentation/programmer-reference/debugging-sites-built-with-toolset/

3) If the problem still persists, please provide database dump file(ZIP file) of your website, also point out the problem page URL and view URL, I need to test and debug it in my localhost, thanks
https://toolset.com/faq/provide-supporters-copy-site/

#1284419
#1284437

Thanks for the details, I am downloading the files, will update here if there is anything found

#1284525

I have downloaded the file database-sent-by-dropbox.zip you provided, it is not valid, there is only a XML file in it.

Please share the database dump file link to my email box: luo.y@onthegosystems.com, then update this thread.

Thanks

#1286087

Hi, Luo. This is the thread that I sent the database for through google drive...Jim

#1286101

Thanks for the details, I can download the files, will update here if there is any found.

#1286113
news-and-ideas.JPG

Here are what I found, I can import your database dump file into my localhost, but it works fine, see screenshot news-and-ideas.JPG

All posts are sort by post date descending.

So it should be a compatibility problem of your website, please try as I mentioned above:
https://toolset.com/forums/topic/sorting-news-items-by-category-with-dropdown-but-want-most-recent-at-the-top-of/#post-1282881

In case it is a compatibility problem, please deactivate all other plugins, and switch to wordpress default theme 2019, deactivate all custom PHP/JS code snippets, and test again

If you need more assistance for it, please try these:
1) Backup your website,
2) Provide your website credentials and FTP access in below private message box, I can try to locate the problem plugin/theme in your website.