Skip to content

Instantly share code, notes, and snippets.

/**
* INSTALLATION: this code should be pasted into your theme's functions.php file.
*
* - Enable CSS transitions for Flex Slider.
* - Fixes some issues with mobile browsers (slides go white after first complete rotation of slides)
*
* Compatibility: Flex Slider.
*/
function metaslider_flex_use_css($options, $slider_id, $settings) {
$options['useCSS'] = "true";
/**
* INSTALLATION: this code should be pasted into your theme's functions.php file.
*
* This code will convert the list of tabs into an ordered drop down menu. Ideal if you have lots of slideshows set up!
*/
function metaslider_max_tabs() {
return 5; // specify the number of tabs you want to see before converting to a dropdown
}
add_filter('metaslider_max_tabs', 'metaslider_max_tabs');
<?php
if (is_page() == 123) {
echo do_shortcode("[metaslider id=XXX]"); // Slideshow to show on page ID 123
}
else if (is_page() == 456) {
echo do_shortcode("[metaslider id=XXX]"); // Slideshow to show on page ID 456
}
else if (is_page() == 789) {
echo do_shortcode("[metaslider id=XXX]"); // Slideshow to show on page ID 789
}
/*
Vantage Theme, remove max width/layer centering.
Usage: Copy and paste this code into your themes style.css file.
*/
body.responsive.layout-full #page-wrapper .metaslider .full-container,
.layout-full #page-wrapper .metaslider .full-container {
max-width: none;
}
/**
* INSTALLATION: this code should be pasted into your theme's functions.php file.
*
* Use this filter to stop Flex Slider from looping back to the start of the slideshow (ending on the last slide)
*/
function metaslider_loop_once($options, $slider_id, $settings) {
$options['after'][] = "if ((slider.currentSlide + 1) == slider.count) { slider.pause(); }";
return $options;
}
add_filter('metaslider_flex_slider_parameters', 'metaslider_loop_once', 10, 3);
/**
* INSTALLATION: this code should be pasted into your theme's functions.php file.
*
* Use this filter to set a custom delay on the first slide in the slideshow.
*/
function metaslider_delay_first_slide($options, $slider_id, $settings) {
$delay = 5000; // delay for first slide in milliseconds
$options['start'][] = "slider.pause(); setTimeout(function(){ slider.play(); }, {$delay});" ;
$options['after'][] = "if (slider.currentSlide == 0) { slider.pause(); setTimeout(function(){ slider.play(); }, {$delay}); }" ;
return $options;
/**
* INSTALLATION: this code should be pasted into your theme's functions.php file.
*
* Use this filter to set a custom delay time on any slide in the slideshow
* ... apart from the first slide! If you need to delay the first slide
* ... see https://gist.github.com/tomhemsley/9247378
*/
function metaslider_delay_slide($options, $slider_id, $settings) {
$delay = 5000; // delay in milliseconds
$slide_to_delay = 2; // 1 = first, 2 == second..
function twentyfourteen_remove_masthead_fixed( $classes ) {
$return = array();
foreach ($classes as $class) {
if ($class != 'masthead-fixed') {
$return[] = $class;
}
}
return $return;
}
/**
* INSTALLATION: this code should be pasted into your theme's functions.php file.
*
* Use this filter to allow linking to a specific slide (Flex Slider only)
* Eg, http://www.yourSiteUrl.com/yourPage?startAt[563]=3&startAt[123]=2
*/
function metaslider_flex_start_slide($options, $slider_id, $settings) {
if (isset($_GET['startAt'][$slider_id])) {
$start_slide = intval($_GET['startAt'][$slider_id]) - 1;