Image Advanced not getting IDs from cloneable field

Support General Image Advanced not getting IDs from cloneable field

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #38908
    indatext.comindatext.com
    Participant

    I just discovered that if Image Advanced field is cloneable, I cannot get images attached to custom post and request for IDs from field returns empty array. This was not the issue few versions ago, it seems.

    I have site where Image Advanced field was set to cloneable. If I remove that setting from the field, I will not get attached images visible on the backend. How can I get them visible again if I drop cloneable option from the field?

    #38916
    Long NguyenLong Nguyen
    Moderator

    Hi,

    Do you mean to attach images to a post on the Media page, list view? If not, can you please share some screenshots of the issue on your site?

    #38918
    indatext.comindatext.com
    Participant

    Yes. If the Image Advanced is set to cloneable, images are not retrievable anymore via

    <?php
    	$images = rwmb_meta( 'portfoliogallery' );
    $image_ids = array_keys( $images );
    $shortcode = '[' . 'gallery ids="' . implode( ',', $image_ids ) . '" itemtag="div" icontag ="div" size="thumbnail" link="file"]';
    
    echo do_shortcode( $shortcode );
    
    ?>

    But when "cloneable" function is unset, images are retrieved OK, but previews are lost on backend, although post keeps array of uploaded images.

    I have 2 copies of site to display this, how can I privately show the issue?

    #38933
    PeterPeter
    Moderator

    Hello there,

    If you set the field image_advanced as a cloneable field, you will need to use 2 for loop to get the image ids. Here is an example:

    $advanced_images = rwmb_meta( 'image_advanced_wyyzp67zec' );
    $image_ids = [];
    foreach ( $advanced_images as $advanced_image ) {
    	foreach ( $advanced_image as $key => $image ) {
    		array_push( $image_ids, $key );
    	}
    }
    $shortcode = '[' . 'gallery ids="' . implode( ',', $image_ids ) . '" itemtag="div" icontag ="div" size="thumbnail" link="file"]';
    
Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.