WordPress.org

Ready to get started?Download WordPress

Forums

How to limit cycle for the lightbox gallery? (1 post)

  1. berez
    Member
    Posted 1 year ago #

    There is a carousel which consists of posts. Each post has a gallery. lightbox works with all the posts and galleries.
    Question - How to limit the effect of the lightbox within a post or a gallery in a post?

    This post code within carousel

    <div id="content">
    	<div id="carousel">
    
    <?php query_posts( array('cat' => 1, 'showposts' => 18) ); ?>
    	 <?php if (have_posts()) : while (have_posts()) : the_post();?>
    
    	<div <?php post_class(); ?>>
     <?php
     if ( has_post_thumbnail()) {
       $large_image_url = wp_get_attachment_image_src( get_post_thumbnail_id(), 'large');
       echo '<a href="' . $large_image_url[0] . '" >';
       the_post_thumbnail();
       echo '</a>';
     }
     ?>
    		<div class="excerpt">
    		<h1><?php the_title(); ?></h1>
    			<p><?php the_excerpt(); ?></p>
    		</div>
    		<div class="entry-content">
    <?php the_content(); ?>
    		</div>
    	</div>
    <?php endwhile; ?>	
    
     <?php endif; ?>
    	</div>
    <a href="#" id="ui-carousel-next"><span>next</span></a>
    				<a href="#" id="ui-carousel-prev"><span>prev</span></a>
    
    				<div id="pages"></div>
    
    <?php>wp_reset_query();?>
    </div><!-- end content -->

    Gallery placed in <?php the_content(); ?>

    This script who add lightbox class to all img

    <script type="text/javascript">
    jQuery(document).ready(function($){
    var select = $('.post-49, .post-1 ').find('a[href$=".bmp"],a[href$=".gif"],a[href$=".jpg"],a[href$=".jpeg"],
    a[href$=".png"],a[href$=".BMP"],a[href$=".GIF"],a[href$=".JPG"],a[href$=".JPEG"],
    a[href$=".PNG"]');
    select.attr('class', 'lb_rlightbox');
    $( ".lb_rlightbox" ).rlightbox();
    });
    </script>

    as is evident from the first code I changed class post. post at <div <? php post_class ();? >> thought that by writing the script, separate classes for each post will solve the issue .. Lightbox but in this case, create a gallery for those posts that I prescribed in the script, and combines them into one big Lightbox gallery ...

    It is necessary that they are not connected and worked separately.
    I would be grateful for any information in this regard.

Topic Closed

This topic has been closed to new replies.

About this Topic