-
AuthorPosts
-
April 7, 2017 at 1:06 am #773615
I have just added a small gallery to a post. I added 5 images. However when I click through the slides that are created it shows 6 images not 5. It includes the featured image in the gallery.
April 7, 2017 at 6:41 am #773702Hey Dandelion222,
First off, thanks for using the Enfold.
May you share your WP credentials? This way our support team can check some settings.
Best regards,
John TorvikApril 7, 2017 at 9:08 am #773776@dandelion222 this is by default in Enfold because the lightbox function is missing the .gallery class in the groups property. The script tries to catch the closest group (css class) wrapped around the image that has been clicked on. Unfortunately without .gallery this is .post-entry. The jQuery script will than pick up all images within the div with class .post-entry. You can verify this by adding some more single images to the post content. They all will appear in the gallery popup.
If you have a child theme you could use a monkey patch in a custom jquery script:
(function($){ var _old_avia_lightbox = $.fn.avia_activate_lightbox; $.fn.avia_activate_lightbox = function( variables ){ if ( ! variables ) { var variables = {}; } variables.groups = ['.gallery', '.avia-slideshow', '.avia-gallery', '.av-instagram-pics', '.portfolio-preview-image', '.portfolio-preview-content', '.isotope', '.post-entry', '.sidebar', '#main', '.main_menu']; return _old_avia_lightbox.call( this, variables ); }; })(jQuery);
Put the code above in a file called mmx.js and put the file in the child theme directory. In the functions.php file of your child you would than add the following lines:
add_action( 'wp_enqueue_scripts', 'mmx_load_scripts', '99' ); function mmx_load_scripts() { wp_enqueue_script( 'mmx', get_stylesheet_directory_uri() . '/mmx.js', array( 'jquery', 'avia-default' ) ); }
April 7, 2017 at 4:14 pm #774057@menmaximus, thank you for that information. I do like knowing why something is happening! I think in this case it is not enough of an issue for me to go to that additional set up. But I use Enfold a lot so it’s good to know this information is available.
I’m guessing that if I ended up using a gallery plugin for galleries in the future that this probably wouldn’t happen because they plugin would be managing it instead. What do you think?
April 7, 2017 at 5:39 pm #774090@dandelion222 it is always difficult to say whether an other gallery plugin will do the job. It may even conflict with enfolds script. My advice: if there is a way to get it done in enfold (like my monkey patch) do it. Each additional plugin is a new potential source of trouble ;-)
April 7, 2017 at 6:02 pm #774107Don’t I know it! Thanks for your help!
-
AuthorPosts
- You must be logged in to reply to this topic.