Skip to content

Instantly share code, notes, and snippets.

@joejwright
Last active July 12, 2019 21:02
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 joejwright/6b170fac6ff5372dfb44c872ec5149fa to your computer and use it in GitHub Desktop.
Save joejwright/6b170fac6ff5372dfb44c872ec5149fa to your computer and use it in GitHub Desktop.
function fix_single_image( $atts ){
$atts = shortcode_atts( array(
'class' => 'vce-single-image',
'src' => '',
'data-width' => '',
'data-height' => '',
'data-img-src' => '',
'alt' => '',
'title' => ''
), $atts );
$buffer = "<img";
foreach ($atts as $key => $value) {
$buffer = $buffer." $key='$value'";
}
$buffer = $buffer." />";
return $buffer;
}
add_shortcode( 'vcvSingleImage', 'fix_single_image' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment