Skip to content

Instantly share code, notes, and snippets.

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);
@tomhemsley
tomhemsley / gist:58387b44303a7214cbd5
Created March 7, 2016 11:37
Meta Slider Rocket Loader (TEST)
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;
}
@tomhemsley
tomhemsley / gist:df6deaad7ecc4fcdc37f
Created December 10, 2015 19:21
Vimeo Loop and HTTPS
function ms_vimeo_loop_and_https($url, $slider_id, $slide_id) {
return "https:" . $url . "&loop=1";
}
add_filter('metaslider_vimeo_params', 'ms_vimeo_loop_and_https', 10, 3);
@tomhemsley
tomhemsley / gist:00df7ea1663affac567d
Created November 16, 2015 13:47
metaslider_fix_agp_font_awesome
function metaslider_fix_agp_font_awesome() {
if( isset( $_GET['page'] ) && $_GET['page'] == 'metaslider' ) {
wp_dequeue_script("colorbox-js");
wp_dequeue_style("colorbox-css");
}
}
add_action('admin_enqueue_scripts', 'metaslider_fix_agp_font_awesome', 10);
function metaslider_fix_beaton() {
if( isset( $_GET['page'] ) && $_GET['page'] == 'metaslider' ) {
wp_dequeue_script("custom-js");
wp_dequeue_script("setup-js");
wp_dequeue_script("upload-js");
wp_dequeue_script("datepicker-js");
}
}
add_action('admin_enqueue_scripts', 'metaslider_fix_beaton', 10);
function ms_vimeo_force_https($url, $slider_id, $slide_id) {
return "https:" . $url;
}
add_filter('metaslider_vimeo_params', 'ms_vimeo_force_https', 10, 3);
@tomhemsley
tomhemsley / gist:c05c662af05c5015ce12
Created June 11, 2015 14:41
Meta Slider - Amazon S3 CloudFront
/**
* Use wp_get_attachment_url to retrieve the attachment URL
*
* Important: Resized images created by Meta Slider are not uploaded to s3.
* Important: Disable cropping in the slideshow settings to stop Meta Slider from outputting a URL to a file that doesn't exist on S3.
*/
function metaslider_s3_cloudfront_url($local_url, $attachment_id) {
return wp_get_attachment_url($attachment_id);
}
add_filter('metaslider_attachment_url', 'metaslider_s3_cloudfront_url', 10, 2);
@tomhemsley
tomhemsley / gist:9137a45290cbdbab1557
Created April 30, 2015 14:24
Meta Slider Tubeplayer Protocol
function metaslider_protocol() {
return "https";
}
add_filter('metaslider_tubeplayer_protocol', 'metaslider_protocol');
/**
* Adds a {comment_count} template tag to Meta Slider Post Feed captions
*/
function metaslider_comment_count($content) {
$content = str_replace( "{comment_count}", comments_number() , $content );
return $content;
}
add_filter( "metaslider_post_feed_template", "metaslider_comment_count" );
@tomhemsley
tomhemsley / gist:e93278442398757eccfc
Created April 21, 2015 11:07
Meta Slider - Nivo Responsive Caption
@media screen and (max-width: 480px) {
.metaslider .nivo-caption * {
font-size: 0.8em;
}
}