Okay
  Public Ticket #942730
Change lightbox...image galery
Closed

Comments

  • Javier started the conversation

    Hello,


    I would like that all lightboxes have the same style as when you see the products...I would like to use for all images and gallery this lightbox...How do I put in all images on the all web, not just products?

    ADD images

    Thanks =)

  • [deleted] replied

    Hi Javier,

    Normally Nivo lightbox is used everywhere in our site, however there might be sections where the lightbox is not initialized (supported initially) so please give me the links of pages containing that lightbox and I will see how you can change it to our lightbox.

  • [deleted] replied

    Hi Javier,

    After adding this code in functions.php:

    // Lightbox support for other pages
    add_action( 'wp_enqueue_scripts', 'lightbox_fix_aurum' );
    add_action( 'wp_footer', 'lightbox_fix_aurum_footer' );

    function lightbox_fix_aurum() {
    # Import Nivo Lightbox
    wp_enqueue_script('nivo-lightbox');
    wp_enqueue_style('nivo-lightbox-default');
    }

    function lightbox_fix_aurum_footer() {
    ?>
    <script>
    jQuery( document ).ready( function( $ ) {
    var checkPPItems = function() {
    jQuery( 'a[data-rel^="prettyPhoto"]' ).each( function( i, el ) {
    var $el = $( el );

    if ( $el.data( 'nivoDone' ) ) {
    return;
    }

    $el.off( 'click' ).unbind();
    $el.nivoLightbox();
    $el.data( 'nivoDone', true );
    } );
    }
    setInterval( checkPPItems, 250 );
    } );
    </script>
    <?php
    }

    The lightbox is now implemented in other pages as well.

  • Javier replied

    Hello Arlind,

    Thank you very much, just one more thing, the only thing is that the old view remains below. also I can not see the next or previous images.

    Thanks =)


  • [deleted] replied

    Hi Javier,

    Modified the previous code that I gave to you to:

    // Lightbox support for other pages
    add_action( 'wp_enqueue_scripts', 'lightbox_fix_aurum' );
    add_action( 'wp_footer', 'lightbox_fix_aurum_footer' );
    add_action( 'template_redirect', 'deregisterPrettyPhoto', 10000 );

    function lightbox_fix_aurum() {
    # Import Nivo Lightbox
    wp_enqueue_script('nivo-lightbox');
    wp_enqueue_style('nivo-lightbox-default');
    }

    function deregisterPrettyPhoto() {
    wp_deregister_script( 'prettyphoto' );
    wp_deregister_style( 'prettyphoto' );
    }

    function lightbox_fix_aurum_footer() {
    ?>
    <script>
    jQuery( document ).ready( function( $ ) {
    var checkPPItems = function() {
    jQuery( 'a[data-rel^="prettyPhoto"]' ).each( function( i, el ) {
    var $el = $( el );

    if ( $el.data( 'nivoDone' ) ) {
    return;
    }

    $el.attr( 'data-lightbox-gallery', "gal" );
    $el.nivoLightbox();
    $el.data( 'nivoDone', true );
    } );
    }
    setInterval( checkPPItems, 250 );
    } );
    </script>
    <?php
    }

    And now you can see previous and next buttons and also prettyPhoto is not shown in backround.