This topic contains 7 reply and 2 voices, and was last updated by hatchmedia 3 years, 11 months ago
Viewing 7 Posts - 1 through 7 (of 7 total)
Author Posts
October 2, 2015 at 11:04 pm 73826
hatchmedia Hey guys, Not sure if this would be possible, but is there a way to set up conditional logic and then send a post to a certain post type depending on which conditions are set? So, I have three forms currently which post to CPT1, CPT2 and CPT3. I want to turn this into one large form and use conditional logic to display the different fields. Ideally, the user will be prompted to select a CPT from a drop down. Then, depending on what they selected, it will pull fields relating to that CPT. Once they have finished filling in the form, the form should know which CPT to post to based on what the user selected originally. Is there a way to make this work? Damien
October 4, 2015 at 3:00 pm 73964
towhid towhid

Hello Damien,

This is about an customization issue. To get this you have to customize the plugin. You must hire an experienced developer who can help you to find a better solution.

And hope that If there’s anything else I can do for you, you won’t hesitate to let me know.

Thanks

October 6, 2015 at 3:27 pm 74186
hatchmedia hatchmedia

Hi Towhid,

Could you give me an idea of where to look please? I am happy to try a few things myself, but would appreciate a little guidance, just to get me started. 🙂

Thanks

Damien

October 12, 2015 at 6:04 pm 74513
hatchmedia hatchmedia

Hello,

I was just wondering if you could give any ideas on this please?

Damien

October 13, 2015 at 1:30 pm 74557
towhid towhid

Hello Damien,

I sincerely apologize for taking so long to respond! I am going to look into this for you and follow up the end of the day.

Thanks

October 13, 2015 at 2:51 pm 74574
hatchmedia hatchmedia

Thanks Towhid,

I appreciate it.

Damien

October 13, 2015 at 3:07 pm 74577
towhid towhid

Hello Damien,

Thanks for the reply!

Does your three form use the similar fields? Then use this code at the bottom of the theme’s functions.php

add_action( 'wpuf_add_post_after_insert', 'change_post_type' );

function change_post_type( $post_id ) {
    $post_data = array(
        'ID' => $post_id,
        'post_type' => get_post_meta($post_id,'post_type',true)
    );
    wp_update_post( $post_data );
}

Also, create a drop-down field. And name the field as Post Type. It will automatically convert into post_type as meta key Now, enter label1= CPT1, label2=CPT2, label3=CPT3. Check this screenshot

Custom Post

Hope the solution will help you to get this work.

Please let me know if there’s anything else I can do for you.

Thanks

October 14, 2015 at 8:02 pm 74654
hatchmedia hatchmedia

Hi Towhid,

From my initial testing, it looks like this is working for me! Thanks so much for the code snippet, I appreciate it.

Damien

Viewing 7 Posts - 1 through 7 (of 7 total)