Plugin Author
Ajay
(@ajay)
Thank you.
To order by date, you can create a filter function for crp_posts_orderby
Untested:
function crp_sort_by_date( $orderby ) {
return ' post_date';
}
add_filter( 'crp_posts_orderby', 'crp_sort_by_date' );
thx, but it doesn’t work …
cheers,
Alex
Plugin Author
Ajay
(@ajay)
What happens when you do it?
Sorry for the long delay …
Nothing happens. Same unordered output as before.
I forgot to disable the cache …
When I add these lines, there appears to be no content reationship altogether, the output is totally unrelated.
Cheers,
Alex
-
This reply was modified 9 years ago by
faglork.
Plugin Author
Ajay
(@ajay)
That’s likely because of the sorting relevance being lost.
Did anyone get this working? It seems to show the oldest posts within my 365 day setting but I want it to show the newest posts.
Well, no. But I limited the range to 100 days, and to same category. This gives fairly recent, relevant results.
I use
Fetch related posts only from: Same categories
Disable contextual matching X
Disable contextual matching ONLY on attachments and custom post types: X
Related posts should be newer than: 100 days
Find related posts based on content as well as title: X
Limit content to be compared: 60
This is ok for me. So far the best results. Would be nice if sorted by date, though.
Cheers,
Alex
-
This reply was modified 8 years, 7 months ago by
faglork.
I just figured it out after reading through the core files…. This is tested and is working. This works if you want to sort by post date (newest first)
Copy this into your functions.php.
function crp_sort_by_date( $orderby ) {
return ' wp_posts.post_date DESC';
}
add_filter( 'crp_posts_orderby', 'crp_sort_by_date' );
This can be marked as resolved