Skip to content

Instantly share code, notes, and snippets.

/**
* 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;
/**
* INSTALLATION: this code should be pasted into your theme's functions.php file.
*
* To Use: Install 'Simple Lightbox'. 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_simple_lightbox($attributes, $slide, $slider_id) {
if (!strlen($attributes['href'])) {
$attributes['href'] = wp_get_attachment_url($slide['id']);
$attributes['data-slb-group'] = $slider_id;
@media screen and (max-width: 480px) {
.metaslider .caption-wrap .caption {
font-size: 12px;
line-height: 1.4em;
}
}
.metaslider .fadeIn {
-webkit-animation-duration:5s;
-moz-animation-duration:5s;
-o-animation-duration:5s;
animation-duration:5s;
}
function metaslider_add_title_and_alt_and_rel_to_anchor($attributes, $slide, $slider_id) {
$attributes['rel'] = 'lightbox';
$attributes['title'] = $slide['title'];
$attributes['alt'] = $slide['alt'];
return $attributes;
}
add_filter('metaslider_flex_slider_anchor_attributes', 'metaslider_add_title_and_alt_and_rel_to_anchor', 10, 3);
/**
* INSTALLATION: this code should be pasted into your theme's functions.php file.
*
* USAGE:
* Install 'Responsive Lightbox'.
* Add an image slide to your Meta Slider slideshow and enter the Vimeo URL in the URL field
*/
function metaslider_respoonsive_lightbox_vimeo($attributes, $slide, $slider_id) {
if (strpos($attributes['href'], 'vimeo.com') !== false) {
/**
* Installation: Copy and paste this code into your themes functions.php file.
*
* NOTES: This will only add font options into the layer editor font dropdown menu,
* - it will not load the actual font from google onto your site
* - use a plugin like http://wordpress.org/plugins/wp-google-fonts/ to load the fonts onto your site
* - if you're using google fonts, you won't see the font applied to the text in the layer editor itself,
* but you will do when you view the slideshow on your site
*/
function metaslider_add_custom_fonts_to_layer_editor($custom_fonts) {
function make_gd_default_image_editor($editors) {
return array('WP_Image_Editor_GD','WP_Image_Editor_Imagick');
}
add_filter('wp_image_editors', 'make_gd_default_image_editor');