• Resolved damiankordian

    (@damiankordian)


    Is it possible to integrate Events Manager with lightbox, to show pictures bigger, once it’s clicked? Like in lighbox galery?

    The page I need help with: [log in to see the link]

Viewing 13 replies - 1 through 13 (of 13 total)
  • The first thing you need to do is to make sure the images are clickable. The placeholder used for the featured image is #_EVENTIMAGE. To make sure this is clickable you need to add the following code snippet (you can use the Code Snippets plugin to add the code snippet):

    add_filter('em_event_output_placeholder','my_em_styles_placeholders',1,3);
    function my_em_styles_placeholders($replace, $EM_Event, $result){
        if( preg_match( '/#_EVENTIMAGE.*/', $result ) ) {
            $url = get_the_post_thumbnail_url( $EM_Event->post_id, 'full' );
            $replace = '<a href="' . $url . '">' . $replace . '</a>';
        }
        return $replace;
    }

    After this you can use the Simple Lightbox plugin to get it to display as a larger image when you click on the image. This will also work for any other image on the page (as long as its clickable).

    Thread Starter damiankordian

    (@damiankordian)

    Hi joneisman, thanks.

    Unfortunately, this snippet is not working for me. It is added – screen below. But, somehow, I cannot click on any image.

    My example page: https://mazurskiewydarzenia.pl/wydarzenia/zajecia-warsztatowe-wokol-swiat-bozego-narodzenia-i-karnawalu/

    It works for me. Did you activate the snippet? Maybe Code Snippets is not working on your site for some reason. Here is some information on various ways to add a code snippet to your website: https://www.wpbeginner.com/beginners-guide/beginners-guide-to-pasting-snippets-from-the-web-into-wordpress/

    Thread Starter damiankordian

    (@damiankordian)

    Thanks joneiseman. This snippet once activated – causes file-paths to be shown under the images:

    And they are still no able to be clicked/open.

    Your code snippet doesn’t match what I suggested. Try doing a copy and then a “paste as text”. It should look like this:

    add_filter('em_event_output_placeholder','my_em_styles_placeholders',1,3);
    function my_em_styles_placeholders($replace, $EM_Event, $result){
        if( preg_match( '/#_EVENTIMAGE.*/', $result ) ) {
            $url = get_the_post_thumbnail_url( $EM_Event->post_id, 'full' );
            $replace = '<a href="' . $url . '">' . $replace . '</a>';
        }
        return $replace;
    }

    Not like what you have.

    Thread Starter damiankordian

    (@damiankordian)

    Yes, yes, yes!!! Thank you! It is working. I was copying the code from e-mail, and because of that it has changed.

    It is working as I wanted ?? Thank you very much!!! You are genius.

    Say joneiseman, using your snippet, my images open in a new page, but I’d like them to open in my lightbox, FooBox. Do you know how I can do this or would I need to use a different lightbox?

    • This reply was modified 10 months, 2 weeks ago by onojane.

    I used the Simple Lightbox plugin and that worked.

    I looked and for FooBox it was necessary to provide the class for the featured image container in FooBox settings: .em-item-image. Now it works, thanks!

    Well I discovered this does not work for the featured images on my location pages. I expect that requires a different hook. EM does not have documentation page on hooks. How can I do this?

    Use the following code snippet for the images on the location page:

    add_filter('em_location_output_placeholder','my_em_loc_placeholders',1,3);
    function my_em_loc_placeholders($replace, $EM_Location, $result){
        if( preg_match( '/#_LOCATIONIMAGE.*/', $result ) ) {
            $url = $EM_Location->get_image_url();
            $replace = '<a href="' . $url . '">' . $replace . '</a>';
        }
        return $replace;
    }

    Yes, this works! I get an email notification for replies to this string but it showed a different version of this code that did not work. Don’t know if that’s because you corrected it later or email messes with the code displayed.

    The code does get messed up in the email version.

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘Is it possible to integrate EM with lightbox?’ is closed to new replies.