• Resolved hugodebe

    (@hugodebe)


    Hi Kadence!

    I edited gallery.php into the Virtue/Pinnacle Toolkit plugin to add 2 buttons in an overlay that appears on mouse hover for the images in galleries. The first button opens the lightbox and the second one to download the image.

    After many researches and tries, I didn’t find the way to bypass the lightbox.

    $output .= '<a href="'.esc_url($attachment_url).'" data-download="picture.jpg" class="download-image" title="Download"><i class="icon-download-alt"></i></a>';

    Is there a class, an url parameter or a syntax to disable or bypass the theme lightbox for an image link?

    Thanks in advance

    • This topic was modified 8 years ago by hugodebe.
Viewing 4 replies - 16 through 19 (of 19 total)
  • hannah

    (@hannahritner)

    Hi hugodebe,
    Have you tried clearing your cache?
    Also, is there a reason you are not using the premium theme if you have already purchased it?

    Hannah

    Thread Starter hugodebe

    (@hugodebe)

    Hi Hannah, we bought VIRTUE Premium in 2016 for another website, that’s why I mentioned the website owner is a Kadence customer.

    Hi Ben, I tried harder to make the fix work, with the help of an expert, but it is definitely not happening. I hope you will include the no-lightbox class in the next update.

    It works well with this small edit in /pinnacle/assets/js/kt_main.js (line 55)

    function kt_find_images() {
     $( 'a[href]' ).not('.no-lightbox').filter( kt_check_images ).attr( 'data-rel', 'lightbox' );
    }

    Thanks for your help

    Thread Starter hugodebe

    (@hugodebe)

    Hi Kadence,

    Some time ago, Ben mentioned a future theme update to add the no-lightbox class to kt_main.js.

    I’m currently loading an edited version of the script. I added the following to function.php into my child theme:

    /**
     * Dequeue a script from Parent Theme
     */
    function my_function_to_dequeue_script() {
     wp_dequeue_script( 'pinnacle_main' );
    }
     
    add_action( 'wp_print_scripts', 'my_function_to_dequeue_script', 200 );
    
    /**
     * Enqueue a script from the Child Theme
     */
    function pinnacle_child_custom_scripts() {
    	wp_enqueue_script('pinnacle_child_main', get_stylesheet_directory_uri() . '/assets/js/min/kt_main.min.js', array( 'jquery' ), '1.0', true );
    }
    
    add_action('wp_enqueue_scripts', 'pinnacle_child_custom_scripts', 1000);

    Into my child theme, I copy and edit kt_main.js (and kt_main.min.js) to replaced the following (line 54):

    function kt_find_images() {
          $( 'a[href]' ).filter( kt_check_images ).attr( 'data-rel', 'lightbox' );
    }

    by this:

    function kt_find_images() {
          $( 'a[href]' ).not('.no-lightbox').filter( kt_check_images ).attr( 'data-rel', 'lightbox' );
    }

    Please let me know if you see anything wrong.

    To see the result, visit the following example page, scroll to the image gallery and click on the download button of any image. https://combibresil.com/volkswagen-combi-t1-split-bresil-1968-ref-c055/

    Thansk
    Hugo

    hannah

    (@hannahritner)

    Hey Hugo,
    Looks like things are working. Are you having any issues with this?
    In the future please start a new thread as this one has been marked as resolved and can easily be overlooked.

    Hannah

Viewing 4 replies - 16 through 19 (of 19 total)
  • The topic ‘Add a download button for images in wp gallery’ is closed to new replies.