Support

Account

Home Forums Add-ons Gallery Field Gallery not displaying

Solved

Gallery not displaying

  • Hi,

    I´m trying to implement the gallery add-on together with the Magnific Pop up http://dimsemenov.com/plugins/magnific-popup/

    But to no avail.

    What I have is a “single.php” page that has this code on the loop:

    <?php while ( have_posts() ) : the_post(); ?>
    <?php get_template_part( 'content', get_post_format() ); ?>
    <?php endwhile; ?>

    and then in the “content-gallery.php” page I have this:

    <?php
    $images = get_field('Gallery');
    if( $images ): ?>
             <ul class="gallery-link">
                <?php foreach( $images as $image ): ?>
                    <li>
                       <a href="<?php echo $image['url']; ?>"><img src="<?php echo $image['url']; ?>" alt="<?php echo $image['alt']; ?>" title="<?php echo $image['caption']; ?>" /></a>
                    </li>
                <?php endforeach; ?>
            </ul>
        <?php?>

    The magnific pop up just needs <ul class=”gallery-link”> so the problem seems to be in the gallery.

    This is not working and I can´t see where the problem is.
    Any help is welcome!

    thanks!

  • Hi @tinybigstudio

    Have you confirmed that in the source code, the gallery field markup is not being created?

    My first thought is that the $images variable is not working because you are using ‘Gallery’ as the field name. Shouldn’t this be ‘gallery’?

    Thanks
    E

  • I am not able to see my images on front end..

    http://rdesignworks.edesignerz.com/#!/project_category/arts/

    can you plz help me

  • Thanks for the info.
    In the end it was some closing tabs problem.

    This is the final working code:

    <?php
    
    $images = get_field('gallery');?>
    
             <ul class="gallery-link">
                <?php foreach( $images as $image ): ?>
                    <li>
                       <a href="<?php echo $image['url']; ?>">
                       	<img src="<?php echo $image['url']; ?>">
            
                       	</a>
                    </li>
                <?php endforeach; ?>
            </ul>
    
    
  • Thanks for the response let me check it …. 🙂

  • Sorry but just want to ask you one more thing …. are you suggested this code for this page only or anywhere ese I missed this code…. http://rdesignworks.edesignerz.com/#!/project_category/arts/

    because when I tested another category i faced the same issue as image is not displaying on any of page……

  • i want more question on what page i need to make any code change if my image is not appearing on front end plz

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

The topic ‘Gallery not displaying’ is closed to new replies.