• Resolved Schalk Joubert

    (@schalkjoubert)


    Hi

    Im trying to use FooBox with ACF Gallery.
    It is working, except for the Description & Title is not showing when hovering over the lightbox.

    Instead, The Alt info is showing.
    Any idea how to fix this?
    Thank you

    <?php $images = get_field('gallery_images');
        if( $images ): ?>
            <div id="photos">
                <?php foreach( $images as $image ): ?>
                    <a href="<?php echo $image['url']; ?>" class="foobox" rel="gallery">
                        <img src="<?php echo $image['url']; ?>" alt="<?php echo $image['alt']; ?>" caption="<?php echo $image['caption']; ?>" description="<?php echo $image['description']; ?>" title="<?php echo $image['title']; ?>" />
                    </a>
                <?php endforeach; ?>
            </div>
        <?php endif; ?>
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author bradvin

    (@bradvin)

    hi

    edit your code slightly to include these attributes on the anchor:

    
    
    data-caption-title="<?php echo $image['caption']; ?>" 
    data-caption-desc="<?php echo $image['description']; ?>"
    
    
    Thread Starter Schalk Joubert

    (@schalkjoubert)

    I, thank you, but that didn’t work.
    It seems the template only allows for Title, and therefor one needs add the everything to the title field:

    <a href="<?php echo $image['url']; ?>" class="foobox" rel="gallery">
    <img src="<?php echo $image['url']; ?>"
    title="<?php echo $image['title'] . '<br>' . $image['caption'] . '<br>' . $image['description']; ?>"
    />
    </a>
    Plugin Author bradvin

    (@bradvin)

    Hi Schalk,

    I do not understand why you cannot add custom data attributes to the template?

    
    <a href="<?php echo $image['url']; ?>" class="foobox" rel="gallery" data-caption-title="<?php echo $image['caption']; ?>" data-caption-desc="<?php echo $image['description']; ?>">
    <img src="<?php echo $image['url']; ?>" />
    </a>
    

    Hi @schalkjoubert,

    We haven’t heard back from you so I’m going to assume that you were able to use the example Brad provided to create a solution.

    Please do feel free to respond if you need any further assistance.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Missing Title & Description’ is closed to new replies.