Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #784228

    I would like to keep the lightbox effect on two pages (WEDDING & SPECIAL OCCASIONS).

    on Woo Single product pages, I would like no lightbox but just the standard hover over a thumbnail and it becomes the large image.

    #784370

    @kbarranco this would need some custom development.

    1. Create a child theme if not already using one
    2. Create a monkey patch to overload Enfolds lightbox defaults

    (function($){
    	var _old_avia_lightbox = $.fn.avia_activate_lightbox;
    	$.fn.avia_activate_lightbox = function( variables ){
    		if ( ! variables ) {
    			var variables = {};
    		}
    		variables.groups = [];
    		variables.autolinkElements = '';
    		variables.videoElements = '';
    		return _old_avia_lightbox.call( this, variables );
    	};
    })(jQuery);

    3. Store the patch in a custom jquery file like my_scripts.js and copy it to your child themes directory
    4. Enqueue the file conditionally from you child theme functions.php

    add_action( 'wp_enqueue_scripts', 'load_my_scripts', '99' );
    function load_my_scripts() {
        global $post;
        $keep_lightbox = array('slug-of-page-to-keep-lightbox', 'slug-of-an-other-page-to-keep-lightbox', 'slug-of-even-an-other-page-to-keep-lightbox');
        if( ! in_array( $post->post_name, $keep_lightbox ) ){
          wp_enqueue_script( 'my-scripts', get_stylesheet_directory_uri() . '/my_scripts.js', array( 'jquery', 'avia-default' ) );
        }
    }
    

    The lighbox will only be active on those pages defined in $keep_lightbox. However this will not remove the link from the images and clicking on them will you open the attachment in the browser.

    #784877

    thanks!!!

    #785461

    Hi,

    Thanks for helping out as always @mensmaximus :-)

    Let us know if you should need any further help on the topic @kbarranco

    Best regards,
    Rikard

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.