• Resolved joshrodgers

    (@joshrodgers)


    Hey there,

    I am trying to create a custom group and know I’m so close, but I’m missing something. I have a page with featured images and am using slb_activate to launch the lightbox, which is working great. I assigned a custom group which kind of works and kind of doesn’t. The group id I assign is getting applied, but each image has a different number in front of the group id so the images don’t function as a group.

    For example, one image has 144_profile and the other has 142_profile. The last part _profile is the same, but the number in front is different.

    My code looks like:

    $id = get_post_thumbnail_id( $post->ID );
    $url = wp_get_attachment_url( $id );
    $content = "<a href='".$url."' class='featured'>".get_the_post_thumbnail($post->ID, 'thumbnail')."</a>";
    if ( function_exists('slb_activate') ) {
    $content = slb_activate($content, "profile");
    }
    echo $content;

    Which outputs:
    https://i.cubeupload.com/oLHMzG.png

    Anyone run into this or know of a possible fix?

    Thanks,
    Josh

    https://www.ads-software.com/plugins/simple-lightbox/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Archetyped

    (@archetyped)

    Hi, do you have the “Group items by Post” option enabled in SLB’s admin settings? That setting will cause images from different posts to be grouped separately as you are seeing, so disabling it should put them all in the same group.

    Another option is to build the entire content block with all of the links before activating it. This should put all links in the same group and will also have the benefit of running slb_activate() only once (rather than multiple times).

    Thread Starter joshrodgers

    (@joshrodgers)

    Archetyped,

    Right on the money!

    I disabled “Group items by Post” and now everything is working. This site doesn’t have a blog where I would want that feature, so this is a great solution!!

    Not really sure how I would build the content block before using slb_activate() – I tried to set that activation outside the while in my loop, but that didn’t work. I know I’m doing something wrong, which is why I used the first suggested solution.

    I might explore this a little more down the road, but it’s fixed and working now ??

    Thanks,
    Josh

    Plugin Author Archetyped

    (@archetyped)

    Awesome, glad to hear it Josh ??

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Custom group has different id’ is closed to new replies.