I created a view of a custom post type and set the ordering to "Last modified" and sort direction to "Descending" which works fine so far.
When opening a single post of this post type with a Toolset template the previous and next links do not show the last modified post but the standard order of wordpress.
Is there a possibility that these links show the same order as in the defined view?
I am using the Astra theme.
Hi,
Thank you for contacting us and I'd be happy to assist.
There is no built-in feature available to change the order of the next/previous posts links, but you can use the WordPress filters to achieve this, as explained in this reply:
https://wordpress.stackexchange.com/a/73194
Example:
function wpse73190_adjacent_post_sort( $orderby )
{
return "ORDER BY p.post_modified DESC LIMIT 1";
}
add_filter( 'get_previous_post_sort', 'wpse73190_adjacent_post_sort' );
add_filter( 'get_next_post_sort', 'wpse73190_adjacent_post_sort' );
The above code snippet can be included through either Toolset's custom code feature ( ref: https://toolset.com/documentation/adding-custom-code/using-toolset-to-add-custom-code/ ) or through the active theme's "functions.php" file.
regards,
Waqar
My issue is resolved now. Thank you!