Title: Gravity forms
Last modified: March 8, 2017

---

# Gravity forms

 *  Resolved [enack](https://wordpress.org/support/users/enack/)
 * (@enack)
 * [9 years, 2 months ago](https://wordpress.org/support/topic/gravity-forms-51/)
 * Hi I was just wondering,
    Is there any way to link this plugin to gravity forms
   somehow? I would love for users to add their opening hours when they register
   so that I can display it on a page
 * Otherwise this is a fantastic plugin, the only thing I have been struggling with
   is the fact that I have to create the opening hours for EACH new user

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Author [janizde](https://wordpress.org/support/users/janizde/)
 * (@janizde)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/gravity-forms-51/#post-8966719)
 * Hi enack,
    this is not directly implemented in the Plugin (and probably won’t
   be in future as in my opinion it’s out of scope of this project), but you can
   use the SetProvider API to implement this behavior on your own and then feed 
   the Plugin with the raw Opening Hours data.
 * More about the SetProvider API on GitHub:
    [https://github.com/janizde/WP-Opening-Hours/blob/master/doc/set-providers.md](https://github.com/janizde/WP-Opening-Hours/blob/master/doc/set-providers.md)
 *  Thread Starter [enack](https://wordpress.org/support/users/enack/)
 * (@enack)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/gravity-forms-51/#post-8984626)
 * Hi Janizde thanks for getting back to me
    I was given a code that uses gravity
   form fields to add to a custom post, I was wondering if you can see any reasons
   why the hours fields are not being added (Im a newbie). Thanks
 * //Create opening hours
    add_action(“gform_after_submission_11”, “create_new_set”,
   10, 2); function create_new_set($entry, $form){ //First need to create the post
   in its basic form $new_set = array( ‘post_title’ => ucwords($entry[15]), ‘post_status’
   => ‘publish’, ‘post_author’ => 16, // this represents admin by default. ‘post_type’
   => ‘op-set’, ‘timeStart’ => (entry[1]),//this will represent the form field that
   has a time field in it ‘timeEnd’ => (entry[2]), ); $post_id = wp_insert_post(
   $new_set); }
 *  Plugin Author [janizde](https://wordpress.org/support/users/janizde/)
 * (@janizde)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/gravity-forms-51/#post-9010680)
 * Hi enack, this will probably not work as wp_insert_post is not aware of `timeStart`
   and `timeEnd`.
 * If you want to add custom Opening Hours by Gravity Forms results there are basically
   two ways:
 * 1. (recommended) Use your own data infrastructure (I believe Gravity Forms stores
   form submissions in their own DB tables) and use the SetProvider API, which I
   have linked to above, to “feed” the Opening Hours core with your data.
 * 2. Add an op-set post through `wp_insert_post` and then add Opening Hours through
   a `Persistence` object: [https://github.com/janizde/WP-Opening-Hours/blob/master/classes/OpeningHours/Util/Persistence.php](https://github.com/janizde/WP-Opening-Hours/blob/master/classes/OpeningHours/Util/Persistence.php)
    -  This reply was modified 9 years, 1 month ago by [janizde](https://wordpress.org/support/users/janizde/).

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Gravity forms’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/wp-opening-hours_3e2c4f.svg)
 * [Opening Hours](https://wordpress.org/plugins/wp-opening-hours/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-opening-hours/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-opening-hours/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-opening-hours/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-opening-hours/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-opening-hours/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [janizde](https://wordpress.org/support/users/janizde/)
 * Last activity: [9 years, 1 month ago](https://wordpress.org/support/topic/gravity-forms-51/#post-9010680)
 * Status: resolved