Support

Account

Home Forums Add-ons Gallery Field Implode Warning when using Gallery

Solved

Implode Warning when using Gallery

  • Hi,

    I added this to my content.php

    	<?php 
     
    $image_ids = get_field('gallery', false, false);
     
    $shortcode = '
     
     
    [gallery ids="' . implode(',', $image_ids) . '"]
    ';
     
    echo do_shortcode( $shortcode );
     
    ?>

    and on each page with or without photos, I get this:

    Warning: implode(): Invalid arguments passed in /home3/findtank/public_html/wp-content/themes/twentyfourteen-child/content.php on line 63

    I feel like there is not a very good instructional guide to using this plug-in, especially since it is a paid one.
    Any and all help is appreciated.

  • I think I may have fixed it. Well, it is working without the error. Here is what I did. I added $image_ids = array(); to the code, so it looks like this:

    	<?php 
     
    $image_ids = get_field('gallery', false, false);
    $image_ids = array();
    
    $shortcode = '
     
     
    [gallery ids="' . implode(',', $image_ids) . '"]
    ';
     
    echo do_shortcode( $shortcode );
     
    ?>

    The documentation should include this

  • Was having the same issue and this worked for me! Thx

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.