How to insert fancybox to multiple separate galleries in a post?

Okay I'm trying to add fancybox functionality to the galleries in posts. I found this stack exchange: How do i add class="fancybox" to the default gallery? and I managed to get the basic fancybox functionality using: jQuery(".gallery-icon a").fancybox().attr('rel', 'gallery'); But it's not grouping the images all in one gallery together. I can click on an image and get a lightbox but there's no scrolling through a group. I tried the solution outlined by @orionrush jQuery('.gallery').each(function (g) { jQuery('a', this).attr('rel', function …
Category: Web

Boombox theme, lightbox on zombify post photos

I use the theme Boombox, I'm searching for a solution to use lightboxes in the zombify posts. I have searched all the internet but I can't find anything. Installing a plugin doesn't work for this. Does anyone have an idea? Thank you
Category: Web

Open image gallery on link click

I have a very simple wordpress problem, but I'm still struggling to figure out the solution. I have an anchor tag, and I want it to open an image gallery in a lightbox (as the default behavior when user clicks on one of the images from the image gallery) on click. The image gallery should be hidden otherwise, visible only when the user clicks "show gallery" link. Here's the code: [gallery link="file" ids="163337,163336,163335,163334"] <a href="#">View gallery</a> Can someone help me …
Category: Web

Ajax the create and edit post form into lightbox and get results

So I have a Wordpress site I built that has custom post types and references to those post types inside others. Example: Custom Post Type 1 Custom Post Type 2 - References Type 1 on two fields Custom Post Type 3 - References Type 2 on multiple fields I have the front end all displaying and working fine. The problem is I need an easier way for my client to be able to edit the references. I built links for …
Category: Web

Link to Lightbox Image-Group from Menu?

Is it possible to link to the first element of a lightbox-group with data-rel attribute from the WP-Menu? I've tried serveral things (JinMenu Plugin, onclick function) but I failed. Do you have any clues for me? Maybe with Javascript? Or Plugin? The links are formatted like this: <a id="nomestart" class="mobx" href="http://www.testurl.at/testbild.jpg" data-rel="nomegroup"><img class="alignnone wp-image-1829" src="http://www.testurl.at/testbild.jpg"/></a> Regards, David
Category: Web

Trying to add attribute to my posts' featured image

I'm trying to add the attribute data-featherlight with a value of 'mylightbox' to all my post featured images. I believe this is the code I need, but I do not know where I put it. I'm working with the baseline twentyseventeen theme. if ( has_post_thumbnail() ) { the_post_thumbnail(); the_post_thumbnail('post_thumbnail', array('data-featherlight'=>'mylightbox')); } Thanks!
Category: Web

How to add a lightbox to class mix?

I have a question: how to add a lightbox to a photo. I've been sitting here a bit and I can not deal with it. <?php //Dynamic Portfolio With Shortcode function portfolio_shortcode($atts){ extract( shortcode_atts( array( 'category' => '' ), $atts, '' ) ); $q = new WP_Query( array('posts_per_page' => 50, 'post_type' => 'portfolio') ); //Portfolio taxanomy query global $paged; global $post; $args = array( 'post_type' => 'portfolio', 'paged' => $paged, 'posts_per_page' => -1, ); $portfolio = new WP_Query($args); if(is_array($portfolio->posts) && …
Category: Web

Duplicate lightbox on galleries from Simple Lightbox (SLB) and Divi (MFP)

I installed Simple Lightbox (SLB), but now when I click an image, I get two lightboxes popping up with the same image. Using "inspect element" I can see that the top one is something like: <div class="mfp-figure" ...<img class="mfp-img" ... and after closing it, the remaining one is something like: <span class="slb_template_tag ...<img ... I suppose the second one is from the Simple Lightbox plugin because its class name starts with SLB. I want to keep it because it has …
Category: Web

Lightbox scroll page down on iPhone

I have portfolio gallery with lightbox viewer. All works fine, but there is a problem on iPhone. After click on image lightbox opens on the bottom of the page. I need to scroll down to see it. Problem is only on iPhone, on other mobile devices it is ok. Tested on Safari and Chrome.
Category: Web

Not displaying Woocommerce product page in lightbox

I have installed a plugin named "WP Post Popup" . It is easy to use and allows any link to show in a lightbox. I have entered the below code $wproduct = get_post( $wproduct_id ); $wslug = $wproduct->post_name; $product_pop = '<a class="modal-link" href="/product/' . $wslug . '"/>View</a>'; echo $product_pop; It is rendering the Lightbox. But the lightbox is not displaying its content correctly. Like this
Category: Web

determine whether content is of type Page or a Post and display accordingly

I'm looking for a way to open every/any link to a blog post in a lightbox/modal globally and without having to any extra classes or rel attribute to the link element. I know I can access this info from within the page or post itself, but is there a way, through some sort of AJAX call I presume, to get this data before the request for the content is actually made so that when I do retrieve the response content, …
Category: Web

customize src attribute in woocommerce single product image

I need to add suffix to the end of image file name (in "href" attribute) that show when i click on the woocommerce single product image. *: I'm using Enfold theme and is using magnific popup frontend code : <div class="woocommerce-product-gallery woocommerce-product-gallery--with-images woocommerce-product-gallery--columns-4 images" data-columns="4" style="opacity: 1; transition: opacity 0.25s ease-in-out;"> <figure class="woocommerce-product-gallery__wrapper"> <a href="https://azadiwood.com/wp-content/uploads/2017/10/Golestan-MDF-30.jpg" class="lightbox-added" title="" rel="product_images[grouped]"> <img width="200" height="325" src="https://azadiwood.com/wp-content/uploads/2017/10/Golestan-MDF-30.jpg" class="attachment-shop_single size-shop_single" alt="" srcset="https://azadiwood.com/wp-content/uploads/2017/10/Golestan-MDF-30.jpg 200w, https://azadiwood.com/wp-content/uploads/2017/10/Golestan-MDF-30-185x300.jpg 185w" sizes="(max-width: 200px) 100vw, 200px"> <span class="image-overlay overlay-type-image" style="left: 0px; top: 5px; …
Category: Web

How can I integrate Fancybox 3 in Wordpress properly

I would like to integrate Facybox 3 in my WordPress (only on posts). It works but I'm a bit bothered cuz the initialize script is loaded after the core minified fancybox js. So, here is the code I added in my child functions.php: // ENQUEUE FANCYBOX SCRIPT function fancy_scripts() { if ( is_single() ) { wp_enqueue_script( 'fancybox-script', 'https://cdnjs.cloudflare.com/ajax/libs/fancybox/3.3.5/jquery.fancybox.min.js', array(), '3.3.5', true ); } } add_action( 'wp_enqueue_scripts', 'fancy_scripts' ); // INITIALIZE function fancy_init(){ if ( is_single() ) { ?> <script> jQuery(document).ready(function($){ …
Category: Web

custom post type grid with content in lightbox

I'm going around every single wordpress plugin and impossible to find something with this featured . . . . I need a grid list of some custom post type - with inline filter. This is fine and tons of plugin can do this, such as essential grid. Otherwise, on click, I need to display the_content on a lightbox, and I can not find anything with this featured.... They all display post on a new page - or just display the …
Category: Web

Customize CSS for "Swipebox " lightbox

I'm using Awesome Flickr Gallery, a plugin to show Flickr galleries on a website; it uses "Swipebox" to display single pictures on a lightbox. The lightbox display two bars, on to and bottom of the screen, di display information and provide navigation controls. I'm trying to customize those bars to match the site fonts and colors, but without success. By inspecting the relevant items with Chrome, I get that these elements are <div id="swipebox-top-bar" class="visible-bars"> and <div id="swipebox-bottom-bar" class="visible-bars"> This …
Category: Web

Render Shortcode in Lightbox Gallery

I am trying to have a video gallery, but I use HolaCDN. Their wordpress plugin lets you insert videos using a shortcode, and that shortcode inserts the necessary javascript to render their video player, which is optimized to use their CDN. I can't find any way to do the following: A gallery of images (I can supply image files for thumnails) When clicked on, a lightbox comes up The lightbox content is the shortcode for HolaCDN so that their video …
Category: Web

Image linking and lightbox

I'm having one problem that i can't solve for quite some time. I'm building a portfolio site using Expositio theme. I need all pictures to open in lightbox when clicked, but instead of that, when I click on image it takes me to media file in new tab. I can see lightbox working for one second and then it jumps on link of the uplaoded image (http://localhost/wordpress/wp-content/uploads/2017/05/otherwork1d.jpg) I need to disable so the lightbox would be visible. If anyone could …
Category: Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.