• I’m building a calendar site listing events.

    It’s a multiauthor site and I’ve build a form using TDO Mini Forms where people can write events. That’s why I can’t use the WP’s built in future publishing.

    One custom field would be the expiration of the post (see below) and other would be the publish date of the post, i.e. event duration.

    Is there a way to set the publish date in a same manner than it is to set the expiration data?

    Expiration date:

    <?php
    if (have_posts()) :
        while (have_posts()) : the_post();
             $expirationtime = get_post_custom_values('expiration');
             if (is_array($expirationtime)) {
                 $expirestring = implode($expirationtime);
             }
    
             $secondsbetween = strtotime($expirestring)-time();
             if ( $secondsbetween > 0 ) {
                 // Enter your post display code after that.
                 the_title();
                 the_excerpt();
                 // Post display code ends here.
             }
         endwhile;
    endif;
    ?>

    All help is greatly appreciated 🙂

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to set the post publish time with custom field?’ is closed to new replies.