• Resolved luuuciano

    (@luuuciano)


    There is any way to have/use an offset in the Post Carousel block?

    Because we are showing 10 items bigger up in the page… and want to show all the others below… so, the offset idea is to filter the latest 10 contents showed up, and show all the rest…

    Best regards!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hello @luuuciano ,

    Unfortunately, as of now, there is no such option to set offset in the Post Carousel block.

    However, this can be achieved using the filter code.

    To apply different filters for different Post Carousel Blocks you need to add unique classes to each of the blocks from the Advanced Tab of Post Carousel Block.

    Please refer to this screenshot.

    After that, you can just add the “if” condition for each of the Blocks.

    For example: If you want to add different Offsets to different blocks you can use the following code for the Post Carousel block:

    function filter_post_query( $query_args, $attributes) {
        // Unique class name added from Advanced tab for Post Carousel Block.
        if ( 'my-post-grid-class' == $attributes['className'] ) {
       
            $query_args['offset'] = 3;
        }
    
        // Unique class name added from Advanced tab for Post Carousel Block.
        if ( 'second-my-post-grid-class' == $attributes['className'] ) {
       
            $query_args['offset'] = 4;
        }
        //And So on....
        return $query_args;
       }
    add_filter( 'uagb_post_query_args_grid', 'filter_post_query', 10, 2 );

    I hope this helps.

    Regards,
    Sweta

    Hello @luuuciano ,

    We haven’t heard back from you in a while, so I’m going to mark this as resolved – if you have any further questions, you can start a new thread.

    Thank you!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Offset on Post carousel? is possible?’ is closed to new replies.