• Resolved coadr93

    (@coadr93)


    Hi. I have to import a custom post type which has main image and secondary images in a gallery.

    Pods is great. It allows for very complex things.

    Initially, I was going to use ACF and CPT UI but then I realised Pods kinda has both, so great.

    Issue is… I can’t really import the images inside the Pods gallery using WP All Import.

    I exported a test one and it has WP database stuff like

    a:24:{s:2:”ID”;s:3:”455″;s:11:”post_author”;s:1:”2″;s:9:”post_date”;s:19:”2021-03-04 21:55:30″;s:13:”post_date_gmt”;s:19:”2021-03-04 21:55:30″;s:12:”post_content”;s:0:””;s:10:”post_title”;s:8:”grecia 9″;s:12:”post_excerpt”;s:0:””;s:11:”
    etc

    I tested with ACF gallery and it does a much simpler export, with filenames separated by |.

    Ex. img1.jpg|img2.jpg|img3.jpg etc

    So I was wondering if this is possible with Pods and how can I use WP All Import to import the gallery images in my custom post types.

    I really don’t want to use ACF only for that gallery field.

    • This topic was modified 3 years, 4 months ago by coadr93.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support Paul Clark

    (@pdclark)

    Looks like your best bet is going to be ACF with WP All Import.

    Plugin Author Jory Hogeveen

    (@keraweb)

    Pods stores the image ID but using the metadata functions is a requirement.
    There was an addon for Pods but it seems it isn’t updated for a while: https://docs.pods.io/plugins/cio-custom-fields/
    Other than that you can best contact WP All Import about this matter.

    Cheers, Jory

    Thread Starter coadr93

    (@coadr93)

    Hey guys.

    Thanks for your responses.

    I asked the WP All Import team and this was their response:

    “Is the gallery a “File / Image / Video” field that allows multiple files? If so, you can import into it by importing images regularly and writing custom code that uses our API ( https://www.wpallimport.com/documentation/developers/action-reference/ ) to store the images as required by Pods.

    Here’s an example snippet that you can modify as needed:”

    function wpai_pods_image_imported( $post_id, $att_id, $filepath, $is_keep_existing_images = '' ) {
         $pods_field_name = 'the_image_gallery';
         
         $existing = get_post_meta( '_pods_' . $pods_field_name, array() );
         
         if ( in_array( $att_id, $existing ) ) return;
         
         $existing[] = $att_id;
         add_post_meta( $post_id, $pods_field_name, $att_id );
    
    }
    add_action( 'pmxi_gallery_image', 'wpai_pods_image_imported', 10, 4 );

    Is this helpful? Think you can help me customize this so that it works to import Gallery Images in PODS with WP All Import?

    Thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Gallery field export import’ is closed to new replies.