Loading post content in FancyBox

The issue is that you are declaring a same ID for every DIV in the LOOP. What you need is to do something like this:

    <ul id="slider2">
<?php
    $args = array( 'post_type' => 'jobs', 'posts_per_page' => 15 , 'order' => 'ASC' );
    $loop = new WP_Query( $args ); $i = 0; ?>
    <?php while ( $loop->have_posts() ) : $loop->the_post(); $i++; ?>
        <li>
            <h4><?php the_title(); ?></h4>
            <?php echo excerpt( '30' ); ?>
            <a class="various1" href="#inline<?php echo $i; ?>" title="Lorem ipsum dolor sit amet">Read more &rarr;</a>
            <div style="display: none;">
                <div id="inline<?php echo $i; ?>" style="width:400px;height:100px;overflow:auto;"><?php the_content(); ?></div>
            </div>
        </li>
    <?php endwhile; wp_reset_query(); ?>
</ul> 

I’ve change the inline1 with inline[?php echo $i; ?].

Hope this solve your problem.

Leave a Comment