Repeat Field Problem

This topic contains 23 reply and 2 voices, and was last updated by Tareq Hasan 10 years, 11 months ago
Viewing 15 Posts - 1 through 15 (of 23 total)
Author Posts
April 19, 2013 at 2:08 pm 2554
Tareq Hasan Hi I am trying to create a form for use with a custom post type 'recipe' which is created by recipepress reloaded plugin. All seems OK except that there is a repeat section which I'm not sure how to do. Attached is a screen of admin section I am trying to recreate. Could you help please. 
April 19, 2013 at 10:26 pm 2578
Tareq Hasan Tareq Hasan

Can you share how the meta values is stored? I don’t know how it stores the data.

April 22, 2013 at 7:36 am 2661
NudeWeb NudeWeb

Hi

I’m not sure shall I send you admin login?

April 22, 2013 at 8:20 am 2662
Tareq Hasan Tareq Hasan

Post the details as a private reply.

April 22, 2013 at 8:23 am 2663
NudeWeb NudeWeb This reply has been marked as private.
April 22, 2013 at 11:46 am 2683
Tareq Hasan Tareq Hasan

Saw the options, the repeatable fields saves the data in a meta key `_recipe_ingredient_value`. In every meta, 5 values are stored.
data. You need some customization to properly capture the custom fields and insert them in appropriate format.

April 22, 2013 at 12:07 pm 2689
NudeWeb NudeWeb

Tareq

Thanks, could you give me an example please.

Marc

April 22, 2013 at 12:41 pm 2697
Tareq Hasan Tareq Hasan

It’s an example how you should deal with it –
[php]
function wpufe_insert_recipe( $post_id ) {
if ( isset( $_POST[‘recipe’] ) ) {
$items = get_post_meta( $post_id, ‘recipe’ );
$ingredients = array();

if ( $items ) {
foreach ($items as $key => $item) {
$values = explode( ‘| ‘, $item );
$ingredients[] = array(
‘quantity’ => $values[0],
‘notes’ => $values[1]
);
}
}

update_post_meta( $post_id, ‘_recipe_ingredient_value’, $ingredients );
}
}

add_action( ‘wpuf_add_post_after_insert’, ‘wpufe_insert_recipe’ );
[/php]

I’ve added a custom field called recipe as a multicolumn repeater and added two columns
recipe

The ingredients field in that plugin is a custom taxonomy, and the link to page is a page dropdown, so you need to deal with that somehow. But you get the idea.

April 22, 2013 at 12:57 pm 2701
NudeWeb NudeWeb

Sorry to be dense where did you add that code I’m not seeing it?

 

April 22, 2013 at 6:16 pm 2722
Tareq Hasan Tareq Hasan

I haven’t add that code, you’ve to add that code. Probably in your themes functions.php.

April 23, 2013 at 8:50 am 2762
NudeWeb NudeWeb This reply has been marked as private.
April 23, 2013 at 9:25 am 2764
Tareq Hasan Tareq Hasan

Sorry, I am pretty busy right now. Won’t have time to do that.

April 23, 2013 at 9:43 am 2766
NudeWeb NudeWeb

Ok I understand, thank you anyway. I have one further problem. With the plugin enabled, it breaks the contact us page. I assume its a jQuery issue, could you tell me how to fix please.

April 23, 2013 at 10:04 am 2768
Tareq Hasan Tareq Hasan

Yes, it’s jQuery issue. May be those jQuery plugins is not included to that page.

JS errors

April 23, 2013 at 10:32 am 2769
NudeWeb NudeWeb

The page works fine when your plugin is deactivated. Your plugin appears to be causing a conflict.

April 23, 2013 at 8:46 pm 2795
Tareq Hasan Tareq Hasan

Seems like there is a fatal error in that page. Does the contact page includes reCaptcha? Might be a possibility of conflict.

Viewing 15 Posts - 1 through 15 (of 23 total)