Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recent docs widget not showing latest docs #711

Open
ParkLai opened this issue Jun 16, 2022 · 4 comments
Open

Recent docs widget not showing latest docs #711

ParkLai opened this issue Jun 16, 2022 · 4 comments

Comments

@ParkLai
Copy link

ParkLai commented Jun 16, 2022

When placing the Recent Docs Widget on a page, it always shows the first 4 (or the number set in "number of docs to show" setting) documents sorted by ID, instead of published date. Therefore the widget will always show the same docs regardless of the new documents being uploaded.

@boonebgorges
Copy link
Owner

Hello @ParkLai - The widget sorts by 'modified', rather than publish date. Can you verify whether this is the behavior on your installation?

You might help to debug by checking the doc_query object here, which should be a WP_Query with 'orderby' => 'modified'.

@ParkLai
Copy link
Author

ParkLai commented Jun 17, 2022

Hi @boonebgorges, think it sorts by ID, as it only shows the first few uploaded docs regardless of their modified date.

I'm looking at the file class-wp-widget-recent-docs.php, and tried adding the 'orderby' parameter to the $doc_args but still it doesn't seem to work.

Can you point me on which file and how should I check the doc_query object?

@boonebgorges
Copy link
Owner

Sorry, I meant to give you this link in the previous comment: https://github.com/boonebgorges/buddypress-docs/blob/d69ab86a2fe6c6f3a61dca6425bc60a9208c3949/includes/templatetags.php#L134=

$bp->bp_docs->doc_query should have the orderby query_var set to modified. My guess is that you have a plugin preventing this from happening.

@ParkLai
Copy link
Author

ParkLai commented Jun 22, 2022

Yes, you're right. Seems like the orderby has been set to title instead of modified. Tried using the filter bp_docs_default_sort_order to set it, but not working. Will check and see what's causing this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants