Support

Account

Home Forums Front-end Issues Custom Field Datepicker shows up on Ctg Page with wrong date in Genesis theme

Unread

Custom Field Datepicker shows up on Ctg Page with wrong date in Genesis theme

    • topsweb

    • October 6, 2019 at 12:50 pm

    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

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.