Custom / manual sort order for dynamic carousel
Hey, is it possible to change the sort order of carousel items by using custom sort logic?
The carousel is dynamically populated with contents from a custom post type.
I added a plugin (https://wordpress.org/plugins/intuitive-custom-post-order/) that enabled custom sort order logic for this cpt but this has no effect on the carousel sort order.
Is there a way to modify the sort logic for this carousel, e.g. via hooks?
-
Hi Daniel,
Thank you for contacting us.
Unfortunately, this is not possible at the moment. This may require custom code to accomplish it, unfortunately, this is beyond the scope of our support.
Sorry for the inconvenience
Best regards,
Ariel H.0 -
Hi Ariel,
no problem with custom code. But please tell me how the carousel is populated with custom content and which general steps need to be taken in order to accomplish this without hacking. Are there any hooks provided by brizy or any core Wordpress hooks that can be used for this?
As a first guess I tried to intercept the $query object with the action hook "pre_get_posts" but it seems that the carousel is not using WP_Query here that would incorporate this hook.
As a brizy pro lifetime license holder, I'd expect at least a bit more support with this. Thanks!0 -
Hi Daniel.
You can use this hook:
add_action('brizy_post_loop_args', function( $args ) {
// manipulate them here
return $args;
});
But, there is no way to know in this hook that this loop is for an archive, posts element or carousel, so if you have multiple posts loops elements on a page the hook above will execute on every loop.
Regards, Natalia
0 -
Thanks Natalia, that helped! I managed to narrow this down to the use case we have here. You should really add some documentation for brizy-specific hooks btw. Regards, Daniel
0
Please sign in to leave a comment.
Comments
4 comments