help with PHP nested IF Category array ‘2008’,’2009′
-
Hi – The code below in my index.php works today in its present form sans the comments. I would like this code to only work if the post is from categories named ‘2008’ or ‘2009’.
I don’t know how to add the if test for 2008 or 2009 after looking for clues online. It would be acceptable to rework my original code to make this work instead of just having a “php if category” wrap around the entire block.
I believe this is the intital test: if is_category(array(‘2008′,’2009’))
Thanks in advance for your helping out.
<?php $expired = get_post_meta($post->ID, 'expdate', $single = true); $todays_date = date("Y-m-d"); ?> <!-- from custom field --> <!-- NEED PHP IF HERE TO TEST IF POST IS FROM CATEGORY NAMED '2008' or '2009' --> <!-- IF CATEGORY == '2008' or '2009' DO THIS CODE ELSE SKIP THIS CODE --> <?php if( $todays_date < $expired ) { ?> <?php if (function_exists('sharethis_button')) { sharethis_button(); } ?> <?php } else { ?> <?php echo '<span style="color:#334D84;font-weight:bold">The Party is Over...</span>' ; ?> <?php } ?> <!-- NEED TO CLOSE NEW PHP IF HERE --> <?php the_content(__('Read more'));?><div style="clear:both;"></div>
Tks.
-Boots
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘help with PHP nested IF Category array ‘2008’,’2009′’ is closed to new replies.