Last active
November 1, 2017 19:29
-
-
Save nextgenthemes/73760faadcf8685e0ebe75fc8f242163 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
<?php | |
function my_arve_image_only( $url ) { | |
add_filter( 'arve_output', 'my_arve_only_img_filter', 10, 3 ); | |
echo do_shortcode( sprintf( '[arve url="%s" /]', $url ) ); | |
remove_filter( 'arve_output', 'my_arve_only_img_filter', 10, 3 ); | |
} | |
function my_arve_only_img_filter( $output, $html_parts, $atts ) { | |
if( ! empty( $atts['img_src'] ) ) { | |
$output = sprintf( | |
'<img%s>', | |
arve_attr( array( | |
'class' => 'example-class', | |
'itemprop' => 'thumbnailUrl', | |
'src' => $atts['img_src'], | |
'srcset' => ! empty( $atts['img_srcset'] ) ? $atts['img_srcset'] : false, | |
'alt' => __( 'Video Thumbnail', ARVE_SLUG ), | |
) ) | |
); | |
} | |
return $output; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment