/var/www/(Del)hsihk.com/wp-content/themes/flatsome/inc/shortcodes/lightbox.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
// [lightbox]
function uxLightboxShortcode($atts$content=null) {
    
$sliderrandomid rand();
    
ob_start();
    
extractshortcode_atts( array(
        
'id' => 'enter-id-here',
        
'width' => '600px',
        
'padding' => '20px',
        
'button' => '',
        
'button_text' => '',
    ), 
$atts ) );
    
?> 

<div id="<?php echo $id?>" class="mfp-hide my-mfp-zoom-in lightbox-white" style="max-width:<?php echo $width ?>;padding:<?php echo $padding?>">
    <?php echo fixShortcode($content); ?>
</div><!-- Lightbox-<?php echo $id?> -->

<script>
jQuery(document).ready(function($) {
   $('a[href="#<?php echo $id?>"]').addClass('open-popup-link-<?php echo $id?>');
   
    $('.open-popup-link-<?php echo $id?>').magnificPopup({
       type:'inline',
       midClick: true,
       mainClass: 'my-mfp-zoom-in product-zoom-lightbox',
       removalDelay: 300
    });

    $('.open-popup-link-<?php echo $id?>').click(function(e){
      e.preventDefault();
    });
});
</script>
<?php
    $content 
ob_get_contents();
    
ob_end_clean();
    return 
$content;
}
add_shortcode("lightbox""uxLightboxShortcode");