Skip to content

Instantly share code, notes, and snippets.

@nextgenthemes
Last active November 1, 2017 19:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nextgenthemes/73760faadcf8685e0ebe75fc8f242163 to your computer and use it in GitHub Desktop.
Save nextgenthemes/73760faadcf8685e0ebe75fc8f242163 to your computer and use it in GitHub Desktop.
<?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