PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Generating standard dates, putting them in custom fields

  1. I need help with dates. (Yeah yeah, I know a girl posting that online is asking for trouble. Shaddup.)

    I have a form where, if you like, you can pay a fee and submit a post and have it be featured for a period of time. You purchase by the week, and can purchase up to three weeks, all starting the day of your purchase. To make the posts show up, I have a theme that will show "featured posts" that only have custom field featureDates equal to or greater than the current date. My problem is that I can't figure out how to get the feature date value into the custom field from the form.

    Any suggestions?

    Posted 13 years ago on Thursday August 18, 2011 | Permalink
  2. Use the Post Custom Field and set it's field type to Date Field. Then configure custom field name to featureDates by selecting it in available custom field names or choosing new and typing in featureDates as the name.

    Posted 13 years ago on Thursday August 18, 2011 | Permalink
  3. Ok, thanks! But that doesn't help me generate the data, I must not have been clear.

    Today is August 18th. Form filler-outer selects "1 week", and submits the form. I want my custom field to be populated with the datecode for August 25th. Tomorrow, another person selects 3 weeks, I want the custom field to be populated with September 9th.

    That's where I'm running into trouble.

    Posted 13 years ago on Thursday August 18, 2011 | Permalink
  4. Can you link to the theme you're using that uses this custom field? We will need to know what format the date needs to be stored in. We can display it in a user-friendly format, but the format it's stored in is going to be important.

    Once we know the exact date format, what we can do is create a set of radio buttons or a drop down, showing the 3 time frames available, starting with 7 days from today, then 14 days, then 21 days.

    I think that will do it. It will be a customization using the gform_pre_render hook to populate your drop down or radio buttons.

    Posted 13 years ago on Friday August 19, 2011 | Permalink