WordPress.org

Ready to get started?Download WordPress

Forums

How to set the post publish time with custom field? (3 posts)

  1. hilj
    Member
    Posted 4 years ago #

    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 :)

  2. hilj
    Member
    Posted 4 years ago #

    Bump

    Anybody have a glue?

    thanks

  3. Why don't you just create another custom field for the start date and use that instead?

Topic Closed

This topic has been closed to new replies.

About this Topic