Created
May 1, 2013 14:15
-
-
Save INDIAN2020/5495487 to your computer and use it in GitHub Desktop.
wordpress: image shortcode
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
/* [image src="" width="" height="" align=""][/image] */ | |
add_shortcode("image","gsn_image"); | |
function gsn_image($atts, $content=''){ | |
extract( shortcode_atts( array( | |
'src' => 'none', | |
'content'=> $content, | |
'width' => '', | |
'height' => '', | |
'align' => 'center' | |
), $atts ) ); | |
$p = ($align != 'center' && $align == 'left') ? 'left;' : 'right;' ; | |
$output ="<div style='border: 1px solid #CECECE; border-radius: 4px;margin:5px 0;' class='clearfix'><img src='$src' width='$width' height='$height' align='$align' style='margin: 5px' />"; | |
$output .= "<p style='margin: 5px; width:65%; float: $p'>$content</p></div>"; | |
return $output; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment