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.

Custom Field question

  1. Good morning

    I realize that the Custom Post Add on plug in isn't an officially supported product (http://wordpress.org/extend/plugins/gravity-forms-custom-post-types/) But the challenge lies in the support that;s seen from the author in resolving the issue I have. Thus, here's my post :)

    I have a couple forms that are all based off of Post types and can get the Title, body, and tags to appear in a new post (yippie!) The issue lies in getting the custom post fields to appear in the body of the post. I can see them listed below the body of the post so I know that the information is being saved. I have been through a dozen or Wordpress.org pages on how to get the custom post fields to appear in the post. Some say to put the code in post.php file, some say the index.php, and yet another says functions.php. My question is two part...

    1: Whats the php code that I need to enter to have the information from the fields brought into the post? Ive tried 3 or 4 different ones and most crash the site or make no difference.

    3: With that code, what file do I need to add it to?

    The Custom post types will be a combination of check boxes, drop downs, and website urls.

    Thanks again for all your support! :)

    **edit**

    I found this code (which I haven't used yet) and was instructed to add it to functions.php. Is there a way to change it to be variable instead of the dedicated post types shown below?

    add_filter( 'pre_get_posts', 'my_get_posts' );
    
    function my_get_posts( $query ) {
    	if ( is_home() )
    		$query->set( 'post_type', array( 'post', 'page', 'album', 'movie', 'quote', 'attachment' ) );
    
    	return $query;
    }
    Posted 11 years ago on Sunday July 29, 2012 | Permalink
  2. Please explain this or post a URL showing this behaviour:

    I can see them listed below the body of the post so I know that the information is being saved.

    Posted 11 years ago on Monday July 30, 2012 | Permalink
  3. For question 1, to show the data stored in a custom field, you need to use get_post_meta or some similar WordPress function in the theme template which us being used to display your Post or Page.

    http://codex.wordpress.org/Function_Reference/get_post_meta
    http://codex.wordpress.org/Function_Reference/get_post_custom

    That is WordPress functionality. Gravity Forms will capture the data for you and store it as custom fields, but it's up to you to display it in your posts. I am not sure how the 3rd party "Custom Post Types" add-on fits into this, if it saves you from having to modify your template or something.

    For question 3, to display the data stored in the custom fields, you need to add the code to the php template being used by your theme to display the post.

    Regarding your edit, I'm unsure of how that works with the add-on you are using.

    Posted 11 years ago on Monday July 30, 2012 | Permalink
  4. Ok, I'm now able to get the data from the custom fields into a new post. Yippie! I searched thru Pagelines forum and found the meta code I needed for functions.php. :)

    The (hopefully) last issue Im encountering is with GF's custom posts. (still the 3rd party add on) When I have a Custom post field with say, check boxes where a user could select multiple choices, it only returns a single result in the custom field. The data saves (even send an email with the correct results... say 3 or 4 selections)

    I posted in the support forum for the add-on and haven't seen a response as of yet. And from the looks of their support forum... i think it may be a while... ;)

    So, any assistance would be awesome...

    Thanks again and if I havent said it yet.... LOVE Gravity Forms.... :)

    *** Edit ***
    In my original post here, I put 'Custom Port' in the title and it should have been 'Custom Field'. It was late and had been working for hours to resolve :)

    Posted 11 years ago on Tuesday July 31, 2012 | Permalink