Skip to content

Change direction of caroussel and slider elements in total theme

I actually just added that to my todo list yesterday! I was looking at WordPress.com and noticed they had carousels going both directions. So I will add this in the next update.

You can use some custom code to change the direction by hooking into “totalthemecore/vcex/carousel/owl/options” and setting the ‘rtl’ to true. Example:

add_filter( 'totalthemecore/vcex/carousel/owl/options', function( $options, $shortcode_atts, $shortcode_tag ) {
    $options['rtl'] = 1;
    return $options;
}, 10, 3 );

You can use the $shortcode_atts variable to check for a specific classname so that it only targets certain carousels. Example:

Then add the ”phalancs-rtl-carousel” classname to the carousel you want.

add_filter( 'totalthemecore/vcex/carousel/owl/options', function( $options, $shortcode_atts, $shortcode_tag ) {
    $shortcode_class = $shortcode_atts['class'] ?? $shortcode_atts['el_class'] ?? $shortcode_atts['classes'];
    if ( $shortcode_class && str_contains( $shortcode_class, 'phalancs-rtl-carousel' ) ) {
        $options['rtl'] = 1;
    }
    return $options;
}, 10, 3 );

An den Anfang scrollen