I am using a slider in a page to display uploaded images. What I would like to do is hide the div if there is no image uploaded. Is there a command in PHP I could use to hide this div?
Here is my slider code
<div id="flex-slider" class="flexslider-main flexslider">
<ul class="slides">
<li>
<img src="[types field="travel-tips-image" url="true" width="770" height="400"][/types]" alt="[wpv-post-title]" >
<div id="credit">Photo by: [wpv-post-author]. </div>
</li>
</ul>
</div>
where
[types field="travel-tips-image" url="true" width="770" height="400"][/types]
is the shortcode from my wordpress plugin. So basically all I want to do is to not display that main div id="flex-slider" if there is no image.
I am thinking the best way to do this would be PHP but since I am a newbie I have no idea how to do it and a web search did not return much I could apply. Could anyone suggest some code to use? The site runs on wordpress. Thanks
Thanks for the reponsis. Of course my biggest problem is that I never actually wrote any JavaScript/JQuery. After your replies and comments I did some research and thought I would adapt a script I found. Here it is:
'$(function(){
// Hide div when no image
if ($("div#flex-slider:not(img)").length) {
$("#flex-slider").hide(); }) });'
This did not work though. To be honest I am not even sure where to place this or if the code is complete but this is pretty similar to what I need to do. Can anyone guide from here?