
This is in the Genesis news-pro theme.
I’ve added the custom field for ‘Expiration Date’ and put the following code in the theme’s functions.php
—–
// ———————-
// custom fields for posts
// ———————-
add_action(‘genesis_entry_content’, ‘expiration_date’);
function expiration_date(){
if (is_single() && genesis_get_custom_field(‘expiration_date’))
$date = genesis_get_custom_field(‘expiration_date’);
$date2 = date(“F j, Y”, strtotime($date));
echo ‘<hr /> <div id=”expiration_date”>Expires: ‘. $date2 .'</div>’;
}
———-
I initially had an issue that on the posts it was ignoring date formats. This adaptation works but now I notice on the category pages a date show sup in the preview as:
Expires: January 1, 1970
I assume that is blank data for that date to appear. However, I don’t want the expiration date to show on the category page, or if it does, it must have the correct date.
The site is currently at http://deals.chicagofuncoupons.com – Click on the menu item such as ‘Things To Do’ which will pull the category.
Appreciate any help.
MDD