Hiding Content
-
Hi
I have set up a custom admin screen in WordPress and i’m pulling in the content using the following code:
<!-- OPENING HOURS --> <h2>Opening Hours</h2> <ul> <?php if($options['monday'] !='') { ?> <li>Monday: <?php echo $options['monday']; ?></li> <?php } ?> <?php if($options['tuesday'] !='') { ?> <li>Tuesday: <?php echo $options['tuesday']; ?></li> <?php } ?> <?php if($options['wednesday'] !='') { ?> <li>Wednesday: <?php echo $options['wednesday']; ?></li> <?php } ?> <?php if($options['thursday'] !='') { ?> <li>Thursday: <?php echo $options['thursday']; ?></li> <?php } ?> <?php if($options['friday'] !='') { ?> <li>Friday: <?php echo $options['friday']; ?></li> <?php } ?> <?php if($options['saturday'] !='') { ?> <li>Saturday: <?php echo $options['saturday']; ?></li> <?php } ?> <?php if($options['sunday'] !='') { ?> <li>Sunday: <?php echo $options['sunday']; ?></li> <?php } ?> </ul>
I wondered how I would alter this code so that if none of the fields are filled in on the admin screen then nothing shows – including the <h2>Opening Hours</h2>.
I’m assuming it’s something like this, but i’m not sure…
<?php if($options['monday'&&'tuesday'&&'wednesday'&&'thursday'&&'friday'&&'saturday'&&'sunday'] !='') { ?> <p>Content Here</p> <?php } ?>
Can someone shed some light?
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Hiding Content’ is closed to new replies.