Hello, I am placing the following code in a wordpress post template.
Help with PHP "If" statement needed
5
Hello,
I am placing the following code in a wordpress post template.
It works fine with either of the lines when used not as a variable or called in an if statement. However, when I add the if statement, and call the variables, the page does not load (dreaded white page syndrome).
Can anyone tell me what I have missed, or how to correct the code?
Many thanks!
I am placing the following code in a wordpress post template.
It works fine with either of the lines when used not as a variable or called in an if statement. However, when I add the if statement, and call the variables, the page does not load (dreaded white page syndrome).
Can anyone tell me what I have missed, or how to correct the code?
Code:
<?php
$future_date = get_the_date('U');
$pub_date = strtotime('+1 month', $future_date);
$date_alt_1 = <<< EOF
<?php _e('Postcards will start being released on', 'themename'); ?> <font color="blue"><?php echo date('M j, Y', $pub_date); ?></font>
EOF;
$date_alt_2 = <<< EOF
<?php _e('Posted by', 'themename'); ?> <?php the_author_posts_link(); ?> <?php _e('on', 'themename'); ?> <?php the_time('F j, Y'); ?>
EOF;
?>
<?php
if ($pub_date > time())
{
echo $date_alt_1;
else
echo $date_alt_2;
}
?> - kevbo22
- [ 1 ] Thanks
- Kirk Ward
- kevbo22
- [ 1 ] Thanks
- Kirk Ward
Next Topics on Trending Feed
-
5