Skip to content

Instantly share code, notes, and snippets.

@hendcorp
Last active August 12, 2017 16:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hendcorp/68f246bbf760083bd639d356ca4babfd to your computer and use it in GitHub Desktop.
Save hendcorp/68f246bbf760083bd639d356ca4babfd to your computer and use it in GitHub Desktop.
WC Vendors Simple Auction - Date Generator
<?php
//Start Date - Set default to todays date
update_post_meta( $post_id, '_auction_dates_from', stripslashes( date('Y-m-d H:i') ) );
//End Date - conditional
if (isset($_POST['_auction_duration'])):
$aucdur = $_POST['_auction_duration'] + 1;
$duration = "+".$aucdur." day";
update_post_meta( $post_id, '_auction_dates_to', stripslashes( date('Y-m-d H:i', strtotime($duration)) ) );
endif;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment