Hi @zzlatevv ,
Thanks for getting in touch with us.
You can get your desired results by changing the query using action/filter provided in this guide: https://wpspectra.com/docs/filters-actions-for-post/
Have a nice day!
I’m sorry, but can you please send me an example? That’s not a good answer.
Hi, do you have an update here?
Hi @zzlatevv,
Please use the below code in the functions.php of the child theme.
function filter_post_query( $query_args, $attributes) { // Modify $query_args values. // Ex. $query_args[‘author’] = 123;
return $query_args;
}
add_filter( ‘uagb_post_query_args_carousel’, ‘filter_post_query’, 10, 2 );
In the above code 123 is the author id, you can replace it with your author id.
Please try and let me know how it goes.
Have a nice day!
Hi, it worked, thank you.
Is there any way to use the widget on the archive page and showing all posts there with this filter enabled? I want to display all posts on the archive with the carousel widget. I also want to have the carousel posts on specific pages by their author. Now it’s working with the author, but if I add the widget on the archive page, it won’t show all posts.
-
This reply was modified 1 year, 8 months ago by
zzlatevv.
Hi @zzlatevv,
It requires more conditions in the code. Please replace 40 with the page id where you want to apply this filter.
function filter_post_query( $query_args, $attributes) { // Modify $query_args values. // Ex.
if ( is_page( 40 ) )
$query_args[‘author’] = 123;
return $query_args;
}
Have a nice day!