This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* INSTALLATION: this code should be pasted into your theme's functions.php file. | |
* | |
* Use this filter to change the margin between each image in the a carousel. | |
* | |
* [It is not possible to do with CSS alone!] | |
*/ | |
function metaslider_carousel_margin($margin, $slider_id) { | |
return 10; // value in pixels | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* INSTALLATION: this code should be pasted into your theme's functions.php file. | |
*/ | |
function metaslider_nofollow($attributes, $slide, $slider_id) { | |
$attributes['rel'] = "nofollow"; | |
return $attributes; | |
} | |
add_filter('metaslider_flex_slider_anchor_attributes', 'metaslider_nofollow', 10, 3); | |
add_filter('metaslider_nivo_slider_anchor_attributes', 'metaslider_nofollow', 10, 3); | |
add_filter('metaslider_responsive_slider_anchor_attributes', 'metaslider_nofollow', 10, 3); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* INSTALLATION: this code should be pasted into your theme's functions.php file. | |
* | |
* This code will display a counter in the form of "X / Y" (where X is the current slide and Y is the total number of slides) below the slideshow. | |
*/ | |
function metaslider_add_counter_div($options, $slider_id, $settings) { | |
$options['start'][] = " | |
var container = $('<div />').addClass('counter_{$slider_id}').css({ | |
'text-align' : 'center', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Always show arrows (Flex Slider) | |
Usage: Copy and paste this code into your themes style.css file | |
*/ | |
.metaslider .flex-direction-nav .flex-prev { | |
opacity: 1; | |
left: 5px; | |
} | |
.metaslider .flex-direction-nav .flex-next { | |
opacity: 1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* INSTALLATION: this code should be pasted into your theme's functions.php file. | |
* | |
* Compatibility: Flex Slider. | |
*/ | |
function metaslider_flex_carousel_move($options, $slider_id, $settings) { | |
$options['move'] = 1; | |
return $options; | |
} | |
add_filter('metaslider_flex_slider_parameters', 'metaslider_flex_carousel_move', 11, 3); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function metaslider_filmstrip_alt_tags( $list_item, $post, $url ) { | |
$alt = get_post_meta( $post->ID, '_wp_attachment_image_alt', true ); | |
$list_item = "<li class=\"ms-thumb slide-{$post->ID} slide-{$post->ID}\" style=\"display: none;\"><img src=\"{$url}\" alt=\"{$alt}\" /></li>"; | |
return $list_item; | |
} | |
add_filter( 'metaslider_filmstrip_list_item', 'metaslider_filmstrip_alt_tags', 10, 3 ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* INSTALLATION: this code should be pasted into your theme's functions.php file. | |
* | |
* To Use: Install 'Easy Fancybox'. Leave the URL blank on an image slide in Meta Slider. | |
* The slide will automatically be linked to it's full image in a lightbox | |
*/ | |
function metaslider_easy_fancybox($attributes, $slide, $slider_id) { | |
if (!strlen($attributes['href'])) { | |
$attributes['href'] = wp_get_attachment_url($slide['id']); | |
$attributes['class'] = 'fancybox'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function metaslider_flex_min_items($options, $slider_id, $settings) { | |
$options['minItems'] = 5; // min number of slides that will always be displayed. | |
$options['maxItems'] = 5; // max number of slides that will always be displayed. | |
return $options; | |
} | |
add_filter('metaslider_flex_slider_parameters', 'metaslider_flex_min_items', 11, 3); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function metaslider_post_feed_and( $args, $slide, $slider_settings, $slide_settings ) { | |
if ( isset( $args['tax_query'][0] ) ) { | |
$args['tax_query'][0]['operator'] = 'AND'; | |
} | |
return $args; | |
} | |
add_filter( 'metaslider_post_feed_args', 'metaslider_post_feed_and', 10, 4); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter( 'script_loader_tag', 'disable_async_for_rocket_loader', 11, 2 ); | |
function disable_async_for_rocket_loader( $tag, $handle ) { | |
if ( strpos( $handle, 'metaslider' ) !== FALSE ) { | |
$tag = str_replace( "<script type='text/javascript'", "<script data-cfasync='false'", $tag ); | |
} | |
return $tag; | |
} |
NewerOlder