If / else / echo help I'm stuck

Hi All,

I’m very much a PHP novice, but I’m working on a Wordpress site and I want to add a countdown to the page template but for it only to display when a certain condition is met.

The code to enter the countdown is

[code]

<?php do_shortcode('[countdown date="17 July" hour="13" minutes="45" seconds="00" format="DHMS"]'); ?>
[/code]

On it’s own this code works, but because I want it to only show under certain conditions I was going to use the following
[php]<?php
$was = get_post_meta($post->ID, ‘was_value’, true);
if ($was == ‘’)
{
echo " “;
} else {
echo " COUNTDOWN CODE HERE”;
} ?>[/php]

…but if I add the countdown code to the ‘COUNTDOWN CODE HERE’ part it just doesn’t work. Is there any way I can combine these two pieces of code so that if the condition is met, the countdown will display and if it’s not - nothing will display.

Help… I’m guessing this is totally the wrong way to do it, but I just don’t know enough to get any further.

Thanks in advance.

Sponsor our Newsletter | Privacy Policy | Terms of Service