Support

Account

Forum Replies Created

  • Thank you very much, this works!

  • Thank you and sorry for taking so long to answer.

    Unfortunately it seems like this isn’t working either. It’s not taking the correct images from the gallery field and shows only the featured image of the post. This is the code I used:

    
    <?php
    
    $images = get_field('MYFIELDNAME');
    $image_ids = array();
    $max = 5;
    $i = 0;
    
    if( $images )
    {
    	foreach( $images as $image )
    	{
    		$i++;
    		
    		if( $i > $max){ break; }
    		
    		$ids[] = $image['id'];
    	}
    }
    
    $shortcode = '[gallery columns="1" link="file" size="medium" ids="' . implode(',', $image_ids) . '"]';
    
    echo do_shortcode( $shortcode );
    
    ?>

    Is there something I’m doing wrong? Any other data I should change in addition to the field name after “get_field”?

  • Thank you very much for your efforts Elliot, unfortunatly this didn’t work with the WordPress default gallery code. I’ve tried with this but it didn’t work:

    <?php
    			
    			$images = get_field('gallery');
    			$max = 5;
    			$i = 0;
    			if( $images ): ?>
    			
    			<?php foreach( $images as $image ): $i++; ?>
                	<?php if( $i > $max){ break; } ?>
    						
    			<?php 
    			$shortcode = '[gallery columns="1" link="file" size="medium" ids="' . implode(',', $image_ids) . '"]';
    			echo do_shortcode( $shortcode ); ?>	
    			
    			<?php endforeach; ?>
    			<?php endif; ?>
  • Thank you very much for the support. I’ve looked at thelink you provided however I couldn’t manage to limit the number of images. I’ve seen other posts in regards to limit the number of images. Could the code be added to the documentation or can you provide it in this post please?

    Thank you

  • All right, thank you. Does your Gallery Addon documentation explain how this could be done? I’m sorry but I’m not an expert and before buying I’d like to have all things clear.

  • Thank you very much elliot.

    So the last question is, can I limit the number of pictures a user can upload into the gallery?

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