• Resolved Clickadelic

    (@clickadelic)


    Hi,

    I’m working on product page for alloy wheels and I would like to use SLB for the details page of a product, meaning:

    I’m using “advanced custom fields” to add 2 upload fields for the image to the product post, then on the details page, I would like to use SLB to give the user the lightbox image.

    Is that possible or rather not the right way to go?

    I think I need to fill out some of these values ?
    e.g.
    data-slb-asset=”1075954400″ data-slb-internal=”0″ data-slb-group=”33″

    Thanks a lot for your answer
    have a look here: https://beta.oxxo-wheels.de/en/products/

    Best Regards

    Toby

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

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

    (@archetyped)

    Hi, you can use slb_activate() to activate links in custom content on a page.

    See here for more information on using slb_activate()+.

    Thread Starter Clickadelic

    (@clickadelic)

    Thank you for the hint, exactly what I was looking for.

    Very nice – much appreciated!

    Best Regards

    Toby

    Thread Starter Clickadelic

    (@clickadelic)

    Hi again,

    I have had a look at the docs, but I can’t get it to work.
    I have a function, which retrieves the image from a custom field:

    function oxxo_createGridImage() {
        $output = '';
        // Prepare all fields to be used
        $img_aside = get_field('img_aside');
        if($img_aside) {
            $output = wp_get_attachment_image( $img_aside, array(255, 192) );
        }
        return $output;
    }

    Then I have used the example code, and passed in the upper function’s output like:

    $content = oxxo_createGridImage();
    if ( function_exists('slb_activate') )
    $content = slb_activate($content);
    echo $content;

    What am I doing wrong?

    I am currently uploading one image (800 x 600) . I want to use that image for the preview in the product grid as well as in the lightbox.

    I hope it is clear, what I would like to achieve.

    Thanks for your patience ??

    Toby

    Plugin Author Archetyped

    (@archetyped)

    Hi, your function is using wp_get_attachment_image() (documentation) output the thumbnail image only. A standalone image is not clickable. The image needs to be wrapped in a link to the image you want to be displayed in the lightbox so that visitors to your site have something to click on.

    You can use get attachment link() (documentation) to retrieve the attachment’s URI.

    Thread Starter Clickadelic

    (@clickadelic)

    Hi man,

    thanks for your patience and your reply ??
    I’ve got it working nicely after some fiddeling.

    For everyone who is looking for a usage like this:

    /* The field profile_image is a file upload field of the ACF Plugin. To activate a Simple Lightbox, do the following: */
    
    /* Get the value of the field */
    $image = get_field('profile_image');
    /* Grab the ID of the image, and pass it to the wp_get_attachment_link function */
    $lightbox = wp_get_attachment_link($image['id']);
    /* Check if the slb_activate function is available */
    if ( function_exists('slb_activate') )
    /* if yes, pass in the variable which holds the package of the link and the image ID in order to activate the lightbox */
    $content = slb_activate($lightbox);
    /* Spit out the whole package */
    echo $content;

    Hope this might help anyone ??

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘SLB / custom post types for product page’ is closed to new replies.