Support » Plugin: Gutenberg Blocks – Ultimate Addons for Gutenberg » “Post Carousel” update – Remove post from carousel

  • Resolved Shmanich

    (@shmanich)


    Hello.
    Please add the opportunity to remove a specific post from the carousel by ID in “Post Carousel”, or to remove the post from the carousel where this carousel works.

    • This topic was modified 4 months, 3 weeks ago by Shmanich.
Viewing 10 replies - 1 through 10 (of 10 total)
  • Djo

    (@johnnyfraisse)

    I agree this would help a lot to be able to restrict by tags or category or ID

    Plugin Support Team Brainstorm Force

    (@brainstormteam)

    Hello @johnnyfraisse,

    You can use the offset parameter in the wp_query function to exclude the latest posts from the WordPress post loop. You can collect all posts IDs in an array in the first loop, and excluded those posts from the second loop using post__not_in which expects an array of post IDs.
    
    You can use the following filter in your child theme’s functions.php file:

    function filter_post_query( $query_args, $attributes) {
     // Modify $query_args values.
     // 123 is the post id you want to exclude.
     $query_args['post__not_in'] = array( 123,456 );
     return $query_args;
    }
    add_filter( 'uagb_post_query_args_grid', 'filter_post_query', 10, 2 );

    In the above code, the array (123, 456), the 123 and 456 in the post ID which you want to exclude.
    
    I hope this helps. Let me know if you have further queries.

    Regards,
    Sweta

    @brainstormteam,
    I have 10 posts (called “Teachers”) and inserted the “post carousel” in each of them so that they display other teachers under each post. For example, post “John Smith”, description, below the description of “post carousel other teachers”, where the current post is excluded from. And in the second post, a different teacher, so John Smith should appear in “post carousel”.

    Plugin Support Team Brainstorm Force

    (@brainstormteam)

    Hello @shmanich,

    Could you please open a ticket with us from here, so that we can have a closer look?

    Looking forward to resolving your issue asap.

    Regards,
    Sweta

    @brainstormteam, hello.

    I’d better show here what I would like to add to the “post carousel”.
    There are several posts about teachers on my site:
    https://yadi.sk/i/4KtP3BovNyXq5g

    There is a “post carousel” that serves as links to other posts:
    https://yadi.sk/i/0ggXmXJ70mwsPg
    https://yadi.sk/i/PFD125FsA248hg

    But in the “post carousel” comes across a link to a post that is already open. He is superfluous in the carousel:
    https://yadi.sk/i/Q2zcV78ORo0Vng

    Therefore, I ask you to add the ability to exclude such posts or by ID in the “post carousel”.

    Plugin Support Team Brainstorm Force

    (@brainstormteam)

    Hello @shmanich,

    I’m so sorry for the inconvenience caused to you. You can exclude posts from the Post Carousel block using the following filter.

    To do that please follow the following steps:-

    • To apply different filters for a specific block you need to add a unique class to the block from the Advanced Tab of Post Carousel Block.
    • You need to get the post IDs of the Pages or Posts you want to exclude.
    • After that, you need to add the following filter in your child theme’s functions.php file.
    function filter_post_query( $query_args, $attributes) {
        // Unique class name added from Advanced tab for Post Carousel.
        if ( 'my-post-grid-class' == $attributes['className'] ) {
            // 123 and 456 is the post id you want to exclude.
            $query_args['post__not_in'] = array( 123,456 );
        }
        return $query_args;
    }
    add_filter( 'uagb_post_query_args_carousel', 'filter_post_query', 10, 2 );

    I hope this helps.

    Regards,
    Sweta

    @brainstormteam, your code didn’t help me. 🙁
    Please add filtering to “Post Carousel” settings.

    Plugin Support Team Brainstorm Force

    (@brainstormteam)

    Hello @shmanich ,

    Could you please open a ticket with us from here, so that we can help you out?

    Looking forward to resolving your issue asap.

    Hello.
    After a recent update, it was possible to remove the current post in “Post Carousel”. Thank!
    Screenshot: https://yadi.sk/i/TU1InONXKz05lg

    Plugin Support Team Brainstorm Force

    (@brainstormteam)

    Yes, @shmanich ! 🙂

    If you need any further help, please do let us know.

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