• Resolved zzlatevv

    (@zzlatevv)


    Hi, is it possible to use the Spectra post carousel widget by author? I want to show posts by a particular author.

    Thank you.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Support mohsinbsf

    (@mohsinbsf)

    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!

    Thread Starter zzlatevv

    (@zzlatevv)

    I’m sorry, but can you please send me an example? That’s not a good answer.

    Thread Starter zzlatevv

    (@zzlatevv)

    Hi, do you have an update here?

    Plugin Support mohsinbsf

    (@mohsinbsf)

    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!

    Thread Starter zzlatevv

    (@zzlatevv)

    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 month, 1 week ago by zzlatevv.
    Plugin Support mohsinbsf

    (@mohsinbsf)

    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!

Viewing 6 replies - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.