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
/** | |
* Converts an ACF date field from DDMMYYYY to DD.MM.YYYY | |
*/ | |
function metaslider_acf_date($content) { | |
$content = str_replace( "{start_date}", date( 'd.m.Y', strtotime( get_field('start_date') ) ) , $content ); | |
return $content; | |
} | |
add_filter( "metaslider_post_feed_template", "metaslider_acf_date" ); |
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_default_thumbnail_plus_fix() { | |
global $pagenow; | |
if ( $pagenow == 'media-upload.php' && isset( $_GET['tab'] ) ) { | |
wp_dequeue_script( 'slt-file-select' ); | |
} | |
} | |
add_action( 'admin_print_scripts', 'metaslider_default_thumbnail_plus_fix' ); |
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
/** | |
* Alter the post feed query arguments to restrict the results to posts | |
* tagged to the current category. | |
* | |
* REQUIRES: Meta Slider Pro 2.4.5+ | |
*/ | |
function metaslider_restrict_to_current_category( $args, $slide, $slider_settings, $slide_settings ) { | |
// check slide ID so we only apply this functionality where it's needed | |
if ( $slide->ID == 101 && is_category() ) { |
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_vimeo_color( $url, $slider_id, $slide_id) { | |
return $url .= "&color=ff0000"; | |
} | |
add_filter( 'metaslider_vimeo_params', 'metaslider_vimeo_color', 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
// remove the default slider | |
remove_action( 'genesis_after_header', 'zp_full_slider' ); | |
// add in meta slider | |
add_action( 'genesis_after_header', 'metaslider_full_slider' ); | |
function metaslider_full_slider() { | |
echo do_shortcode("[metaslider id=20 restrict_to=home]"); | |
} |
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_variable_heights($options, $slider_id, $settings) { | |
$options['start'][] = "setTimeout( function() { slider.trigger('resize') } , 500 );"; | |
return $options; | |
} | |
add_filter('metaslider_flex_slider_parameters', 'metaslider_variable_heights', 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
/** | |
* 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. | |
* | |
* Compatibility: Flex Slider. | |
*/ | |
function metaslider_flex_disable_touch($options, $slider_id, $settings) { | |
$options['touch'] = "false"; | |
return $options; | |
} | |
add_filter('metaslider_flex_slider_parameters', 'metaslider_flex_disable_touch', 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
/** Dequeue theme specific JS scripts from the YouTube and Vimeo tabs **/ | |
function ms_dequeue_scripts() { | |
wp_dequeue_script( 'eye' ); | |
wp_dequeue_script( 'utils' ); | |
wp_dequeue_script( 'bg-cutom' ); | |
} | |
add_action("metaslider_youtube_iframe", "ms_dequeue_scripts"); | |
add_action("metaslider_vimeo_iframe", "ms_dequeue_scripts"); |
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_prepend_theme_css_selector($selector, $slider_id) { | |
return '#content ' . $selector; | |
} | |
add_filter('metaslider_theme_editor_css_selector', 'metaslider_prepend_theme_css_selector', 10, 2); |