Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress

thickbox is showing same post content

thickbox is showing first post content on every post how to solve this problem. Please help!!!!

<?php

$args = array(
   'post_type'  => 'offers',
   'meta_query' => array(
      array(
         'key'     => '_wpb_offer_type',
         'value'   => 'Deal',
         'compare' => '='
      )
   ),
);

$query = new WP_Query( $args );

?>

<div class="owl-container">
    <ul id="recent-offers-deals" class="owl-carousel">


        <?php if ( $query->have_posts() ) :  while (  $query->have_posts() ) : $query->the_post(); ?>

            <li class="offers">
                <div class="thumbnail">
                   <?php the_post_thumbnail(''); ?>
                   <h3 class="offer-fav pull right"><i class="fa fa-heart"></i></h3>
                   <div class="caption">
                        <h3 class="offer-heading"><?php the_title(''); ?></h3>
                        <p class="offer-details">
                           <?php echo get_post_meta( get_the_ID(), '_wpb_offer_details', true ); ?>
                        </p>
                        <p>
                            <a class="tc" data-toggle="tooltip" data-placement="right" title="<?php echo get_post_meta( get_the_ID(), '_wpb_terms_&_conditions', true ); ?>">tc</a>

                            <a class="btn btn-primary btn-lg btn-block thickbox" href="#TB_inline?width=600&height=550&inlineId=deals<?php $post->ID; ?>">
                                     Activate Now
                            </a>

                        </p>
                    </div><!-- End of caption div -->
                </div><!-- End of thumbnail div -->
            </li><!-- End of first coupon -->

            <div id="deals<?php $post->ID; ?>" style="display:none;">
                 <div>
                    <?php the_post_thumbnail(''); ?>
                    <h3 class="offer-heading"><?php the_title(''); ?></h3>

                     <a class="btn btn-primary btn-lg" href="<?php echo get_post_meta( get_the_ID(), '_wpb_affilate_url', true ); ?>">
                         Let's go
                     </a>
                 </div>
            </div>


        <?php endwhile; else : ?>
            <p><?php _e( 'Sorry, no posts matched your criteria.' ); ?></p>
        <?php endif; ?>




    </ul>
</div>

1 Answer

Matthew Proudman
Matthew Proudman
11,879 Points

could you explain what you are trying to do?

Yes I want to popup details of the post whenever user clicks "Activate Now'. but right now whenever i click activate now button i always get the details from the first post in the modal. Please help!!! and thanks for your kind response.