Home Forums Plugin Support WP User Frontend Pro Repeat Field Problem

This topic is: resolved

This topic contains 23 replies, has 2 voices, and was last updated by  Tareq Hasan 5 years, 10 months ago.

Viewing 15 posts - 1 through 15 (of 24 total)
  • Author
    Posts
  • #2554

    NudeWeb
    Participant
    Post count: 11

    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. 

    #2578

    Tareq Hasan
    Keymaster
    Post count: 2831

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

    #2661

    NudeWeb
    Participant
    Post count: 11

    Hi

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

    #2662

    Tareq Hasan
    Keymaster
    Post count: 2831

    Post the details as a private reply.

    #2663

    NudeWeb
    Participant
    Post count: 11
    This reply has been marked as private.
    #2683

    Tareq Hasan
    Keymaster
    Post count: 2831

    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.

    #2689

    NudeWeb
    Participant
    Post count: 11

    Tareq

    Thanks, could you give me an example please.

    Marc

    #2697

    Tareq Hasan
    Keymaster
    Post count: 2831

    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.

    #2701

    NudeWeb
    Participant
    Post count: 11

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

     

    #2722

    Tareq Hasan
    Keymaster
    Post count: 2831

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

    #2762

    NudeWeb
    Participant
    Post count: 11
    This reply has been marked as private.
    #2764

    Tareq Hasan
    Keymaster
    Post count: 2831

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

    #2766

    NudeWeb
    Participant
    Post count: 11

    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.

    #2768

    Tareq Hasan
    Keymaster
    Post count: 2831

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

    JS errors

    #2769

    NudeWeb
    Participant
    Post count: 11

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

Viewing 15 posts - 1 through 15 (of 24 total)

The topic ‘Repeat Field Problem’ is closed to new replies.