Back to CodeFleet.net

Filters

These are the official documented filters for Cyclone Slider. The filters not listed here but are in the source code might be removed in the future.

cycloneslider_image_sizes

Filter the image sized used by templates.

Usage

add_filter( 'cycloneslider_image_sizes', 'myprefix_cycloneslider_image_sizes' );
function myprefix_cycloneslider_image_sizes( $image_sizes ){
    // Do something with $image_sizes
    return $image_sizes;
}

cycloneslider_services

Filter the services. You can use it to remove or override the core classes.

Usage

Here it is use to remove the import and export page. You must hook this filter inside plugins_loaded in a sub-plugin.

// Hook this before the plugin loads. Notice the action priority is 9.
add_action( 'plugins_loaded', 'cycloneslider_remove_import_export_init', 9 );
    function cycloneslider_remove_import_export_init() {

    // Filter the services to remove the import and export page
    add_filter( 'cycloneslider_services', 'cycloneslider_remove_import_export_override_services' );
}

function cycloneslider_remove_import_export_override_services( $services ) {

    // Unset services
    unset(
        $services['exporter'],
        $services['importer'],
        $services['export_page'],
        $services['import_page']
    );

    return $services;
}

cycloneslider_settings

Filter the slideshow settings just before saving.

Usage

add_filter('cycloneslider_settings', 'myprefix_cycloneslider_settings', 10, 2);
function myprefix_cycloneslider_settings($settings_to_save, $slider_id){
    // Do something with $settings_to_save
    return $settings_to_save;
}

cycloneslider_slides

Filter the slides just before saving.

Usage

add_filter( 'cycloneslider_slides', 'myprefix_cycloneslider_slides' );
function myprefix_cycloneslider_settings( $slides_to_save ){
    // Do something with $slides_to_save;
    return $slides_to_save;
}

cycloneslider_template_list

Filter the template list. You can use it to add your own template in the list.

Usage

add_filter( 'cycloneslider_template_list', 'cycloneslider_template_tcycle' );
function cycloneslider_template_tcycle( $template_list ) {

    $template_list[ 'tcycle' ] = array(
        'name'          => 'tCycle',
        'path'          => realpath( plugin_dir_path( __FILE__ ) ),
        'url'           => plugin_dir_url( __FILE__ ),
        'supports'      => array(
            'image'
        ),
        'location_name' => 'plugin',
        'scripts'       => array(
            'tcycle.js'
        ),
        'styles'        => array()
    );

    return $template_list;
}

cycloneslider_view_vars

Filter the view variables of the slideshow.

Usage

See Template Vars

add_filter( 'cycloneslider_view_vars', 'myprefix_cycloneslider_view_vars' );
function myprefix_cycloneslider_view_vars( $vars ){
    // Do something with $vars
    return $vars;
}