Last active
August 29, 2015 13:56
-
-
Save tomhemsley/9100466 to your computer and use it in GitHub Desktop.
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. | |
* | |
* USAGE: Leave the slide URL blank in Meta Slider. It will automatically be linked to it's full sized image. | |
* | |
* Compatibility: Flex Slider, Nivo Slider, Coin Slider, Responsive Slides. | |
*/ | |
function metaslider_link_to_full($attributes, $slide, $slider_id) { | |
if (!strlen($attributes['href'])) { | |
$attributes['href'] = wp_get_attachment_url($slide['id']); | |
} | |
return $attributes; | |
} | |
add_filter('metaslider_flex_slider_anchor_attributes', 'metaslider_link_to_full', 10, 3); | |
add_filter('metaslider_nivo_slider_anchor_attributes', 'metaslider_link_to_full', 10, 3); | |
add_filter('metaslider_responsive_slider_anchor_attributes', 'metaslider_link_to_full', 10, 3); | |
add_filter('metaslider_coin_slider_anchor_attributes', 'metaslider_link_to_full', 10, 3); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment