archetyped / simple-lightbox

The highly customizable lightbox for WordPress
http://archetyped.com/tools/simple-lightbox/
GNU General Public License v2.0
75 stars 33 forks source link

Plugin does not work gallery_shortcode #1067

Closed BAProductions closed 7 months ago

BAProductions commented 7 months ago

Description of Problem

if I render a gallery using gallery_shortcode function in the custom i'm building ATM, it link to attachment page or the file & not the light box below is the code im using witch works with the previous lightbox plugin Responsive Lightbox granted if im not using my own plugin to make the gallery render in a jetpack style slideshow.

<!-- Post Gallery -->
<div id="post-item-thumbnail-<?php the_ID(); ?>" class="post-thumbnail u-cf">
    <?php
    preg_match('/\[gallery.*ids=.(.*).\]/', $post->post_content, $ids);
    $gallery_args = array(
        'ids' => $ids[1],
        'type' => 'carousel',
        'columns' => is_single() ? '3' : '6',
        'link' => is_single() ? 'file' : 'attachment',
        'size' => is_single() ? 'medium' : 'universal-small',
    );
    echo gallery_shortcode($gallery_args);
    ?>
</div>

<?php if (is_single()) : ?>
    <span class="u-spacer-h u-spacer-light"></span>
<?php endif; ?>

Details

archetyped commented 7 months ago

Unfortunately, gallery_shortcode() does not provide the necessary hooks automatically activate the image links it generates.

However, you can use slb_activate() to activate the links generated by that function for display in the lightbox when clicked. See SLB's Activation documentation for full details.

BAProductions commented 7 months ago

Actually, it does cause I've done it before