-
AuthorPosts
-
April 27, 2017 at 10:13 pm #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.
April 28, 2017 at 9:39 am #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.phpadd_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.
April 29, 2017 at 1:25 am #784877thanks!!!
May 1, 2017 at 4:41 am #785461Hi,
Thanks for helping out as always @mensmaximus :-)
Let us know if you should need any further help on the topic @kbarranco
Best regards,
Rikard -
AuthorPosts
- You must be logged in to reply to this topic.
