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.

How did they do this using GF? Adding City data in the post header.

  1. ditokazi

    Press75 who is using GF has managed to get the field input value "Location" displayed in their post title see here it says Phoenix

    Now I v'e tried the following using the same theme

    in my function.php I 've added

    get_gf_field_value($form_id, $field_id)

    and in my Single.php I've added

    Location:<?php echo get_gf_field_value(1,1); ?>

    1 being my form id and 1 being my input value for location.

    but nothing shows up in my post. I am missing code in my function.php? am I not calling it properly?

    I would appreciate any help on this, I've read alot of post but I guess I can't wrap my mind around it to get it right.

    thanks for the great script.

    Posted 9 years ago on Wednesday February 16, 2011 | Permalink
  2. ditokazi

    I also want to add, I don't want this information in the body I want it in the header as shown , so I don't think using post body template will work for me. I also looked at the and I tried adding

    location as my key, but I didnt know what to add as the value...would it be simply location?

    Posted 9 years ago on Wednesday February 16, 2011 | Permalink
  3. First off you can't use internal function calls to display entry data in your themes functions.php file. So using get_gf_field_value($form_id, $field_id) isn't going to work. That is for entry data, not post data.

    Secondly the Press75 site uses Custom Fields for these data.

    They have a Gravity Form that is configured to create a WordPress post. In order to do this you need to use Post Fields. Post Fields are the only field types that will create a WordPress Post from a form.

    If you want a field for location you would have to use a Post Custom Field and give it a name of location (the name is the key when configuring the custom field) and then in your theme you would have to display the custom field with the key location.

    This is how Press75 is doing things with their job post theme. They use Gravity Forms with Post Custom Fields and store the data in post meta and then their theme is configured to display that custom field.

    So if you are creating a post using a Gravity Form you need to make sure you are using the Post Fields.

    - Post Title to create the title of the post
    - Post Body to create the content of the post
    - Post Custom Fields to create custom fields

    If you want to display the custom field values in your theme you have to then configure your theme to show the custom field values. It doesn't do this automatically, you have to configure your theme to output this information.

    Posted 9 years ago on Wednesday February 16, 2011 | Permalink
  4. ditokazi

    Hello thanks for your reply,

    SO when you say configure my theme are you referring to the function.php? can you lead me in the direction of the type of code formating I can use?

    Posted 9 years ago on Wednesday February 16, 2011 | Permalink
  5. No, when I refer to configuring your theme I am referring to the implementation of custom fields within the theme file for your posts. You were on the right track with this documentation:

    That is what you are going to have to learn, how to implement and use WordPress custom fields. That is what Press75 is using for the Location information and other non-post body content that was implemented in that Job theme. That is what you would have to implement in order to accomplish what you want to do.

    So you are going to have to learn how to implement and use Custom Fields, also referred to as Post Meta.

    Posted 9 years ago on Wednesday February 16, 2011 | Permalink
  6. ditokazi

    Ok I am almost there. I managed to used custom fields to get the location to show up but the only issue is that my location stays the same for every post because I have
    my key as "location" and my value as "Sydney" my question is what is the code to put into the value box to pull gravity form values? is it something like gf_field id (2) ?


    Posted 9 years ago on Wednesday February 16, 2011 | Permalink
  7. I think there is a disconnect between what you are trying to do and how you are supposed to be doing this.

    I'm not sure what you are referring to by gf_field id(2). You shouldn't be writing any code that interacts with Gravity Forms itself. What are you referring to as far value box? I'm not 100% sure what you are referring to.

    To populate a custom field value you can do everything from the Gravity Forms form builder itself and then customizing your theme to display the custom/post meta field.

    If you want a field on your form that populated this location as a custom field then you need to...

    - Edit your form
    - Add a Post Custom Field to your form
    - Edit this Post Custom Field
    - Select "New" under Custom Field Name
    - Type "location" in the custom field name input box

    See this screenshot:

    That is all you have to do to configure that Post Custom Field to save it's value using the key "location" in the post meta table.

    The value that will be stored in that custom field will be whatever the user enters when submitting the form.

    Keep in mind that to create a post you also need to have a Post Title and Post Body field on your form. Those have to be present in order for the post to be created.

    Posted 9 years ago on Wednesday February 16, 2011 | Permalink