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 Data + Array in Custom Post Meta

  1. Hey Guys! I am running GF and the Custom Post Plugin and I've run into a bit of a problem...

    The template I am using implements a custom post type as a "directory"

    I've created a form that will save the submission title, body and featured image into this custom post. But, I also have several custom fields (besides custom post related- Title, Body, etc.) who's data I would like to bundle into an array and inserted into the custom post's meta.

    Any pointers?

    Posted 11 years ago on Tuesday May 7, 2013 | Permalink
  2. I've written an action hook in my functions.php file...can anyone tell me if I'm heading in the right direction?

    function theme_integration($post, $form) {
    
    $post = get_post($entry["post_id"]);
    
    $def_lat = $def_long = 0;
    
    if ( isset( $_POST['location'] ) ) {
    list( $def_lat, $def_long ) = explode( ',', $_POST['location'] );
    }
    
    	$ait_dir_item = array(
    		'address' => $entry['dummy_ID'],
    		'gpsLatitude' => $entry['dummy_ID'],
    		'gpsLongitude' => $entry['dummy_ID'],
    		'streetViewLatitude' => $entry['dummy_ID'],
    		'streetViewLongitude' => $entry['dummy_ID'],
    		'streetViewHeading' => '0',
    		'streetViewPitch' => '0',
    		'streetViewZoom' => '0',
    		'telephone' => $entry['dummy_ID'],
    		'email' => $entry['dummy_ID'],
    		'web' => $entry['dummy_ID'],
    		'hoursMonday' => $entry['dummy_ID'],
    		'hoursTuesday' => $entry['dummy_ID'],
    		'hoursWednesday' => $entry['dummy_ID'],
    		'hoursThursday' => $entry['dummy_ID'],
    		'hoursFriday' => $entry['dummy_ID'],
    		'hoursSaturday' => $entry['dummy_ID'],
    		'hoursSunday' => $entry['dummy_ID'],
    		'alternativeContent' => $entry['dummy_ID']
    );
    
    update_post_meta( $post_id, '_ait-dir-item', $ait_dir_item );
    }
    
    add_action("gform_after_submission_1", "theme_integration", 10, 2);
    Posted 11 years ago on Wednesday May 8, 2013 | Permalink
  3. iHuman
    Member

    I'm working on something similar. Were you able to resolve the issue of submitting CPT meta data in the form of an array?

    Posted 11 years ago on Friday June 28, 2013 | Permalink
  4. edmission
    Member

    I've got exactly the same issue, I need to end up with a date array with keys for day, month, year to match the date custom field in my theme

    Posted 11 years ago on Wednesday July 3, 2013 | Permalink
  5. Richard Vav
    Administrator

    If you still require assistance with this please open a new support ticket or a priority support ticket if you are a developer license holder. Thank you.

    Posted 11 years ago on Friday July 26, 2013 | Permalink

This topic has been resolved and has been closed to new replies.