I have a shortcode that creates an “opinion box”.
The user should insert 4 parts
- the title
- the images
- the opinion
- side of the image in relationship with text
i want to check if no image was entered and in such
a case take a default image from /images/ folder…
but to do so without changing the ‘paste Img Url’
statement which i need in order to explain to the
user where to put the image if exists.
This is the shortcode:
function opinionBox( $atts, $content = null ) {
extract( shortcode_atts( array(
'title' => 'yourtitle',
'imgURL' => 'paste Img Url',
'side' => 'left'
), $atts ) );
return '
<div class="opinionBOX">
<div style="float: '. $side .';" class="myimg">
<img alt="'. $title .'" src="'. $imgURL .'">
</div>
<div class="speakerBOX">
<span class="highlight_black">'. $title .'</span><p></p>
'. $content .'
</div>
<br style="clear: right;">
</div>
';
}
add_shortcode( 'opinionbox', 'opinionBox' );
add a conditional statement before the line with ‘return’, for example:
http://codex.wordpress.org/Function_Reference/get_stylesheet_directory_uri