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!

    • Elliot

    • November 7, 2013 at 12:39 pm

    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

    • veena

    • November 20, 2013 at 4:07 pm

    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>
    
    
    • veena

    • November 20, 2013 at 9:30 pm

    Thanks for the response let me check it …. 🙂

    • veena

    • November 22, 2013 at 6:04 pm

    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……

    • veena

    • November 22, 2013 at 6:08 pm

    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)

You must be logged in to reply to this topic.

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.