Support » Fixing WordPress » Jquery Cycle showing images from all custom posts

  • I have two pages in wordpress, one that shows thumbnails (images from the repeater field of a custom post) and one that shows the slider (Using Jquery Cycle loads the images of the repeater field of the custom post).

    The page of the thumbnails shows only the thumbnails of the project i’m viewing but the problem is that the page of the slider, loads all images of all the custom posts that I have in wordpress.

    Here it’s the site (this page shows the thumbnails):

    If you click any thumb it gets to the page of the slider.

    This is the code of the page with the thumbnails to get the images from the custom post repeater field:

    <?php $post_id = $post->ID;  ?>
    	<?php $query = new WP_Query( 'post_type=artworks_post&posts_per_page=-1&order=DESC&page_id='.$post_id ); ?>
    	<?php while ( $query->have_posts() ) : $query->the_post(); ?>
    	<?php  $slides = get_field('project_slider');
    		// Grabs the array
    		if($slides) {
    			$i = 0;
    			foreach($slides as $s) {
    				echo '<div id="" counter="'.$i++.'" class="item project_slider"> ';
    				echo '<div class="aimagediv" >'; //
    				echo '<a>';
    				echo '<img src="'.$s['project_image'].'" alt="" width="240" />';
    				echo '</a>';
    				echo '</div>'; //aimagediv
    				echo '<div class="art_title">';
    				echo '<p>'.$s['project_title'].'</p>';
    				echo '</div>';
    				echo '<div class="mask">';
    				echo '</div>';
    				echo '</div>'; //first div

    And this is the code of the page with the slider:

    <?php $query = new WP_Query( 'post_type=artworks_post&posts_per_page=-1&order=DESC' ); ?>
    	<?php while ( $query->have_posts() ) : $query->the_post(); ?>
    	<?php $slides = get_field('project_slider');// Grabs the array
    		// Check if there is any data in the array before looping
    		if($slides) {
    			echo '<div id="slideshow">';
    			echo '<ul id="slides">';
    			foreach($slides as $s) {
    				echo '<li>';
    				echo '<img src="'.$s['project_image'].'" alt="" height="480" />';
    				echo '<span>'.$s['project_title'].'</span>';
    				echo '<span class="project_description">'.$s['project_description'].'</span>';
    				echo '</li>';
    				echo '</ul>';
    	<?php endwhile; // end of the loop. ?>

    I tried adding the two lines that get’s the id from the thumbnails page: “$post_id = $post->ID;” to the slider page but it just stop working the slider.

    Any ideas how to display in the slider only the images of the custom post we open?

Viewing 1 replies (of 1 total)
  • ‘Project Coke’ and ‘Sweet Life’ are your posts; each displays thumbnails for their own post; but, every thumbnail calls the same page (page id=42) regardless of the post id, the only difference being the slide number clicked.

    Does anybody know how can I pass the post id through to page 42 when the thumbnail is clicked?

Viewing 1 replies (of 1 total)
  • The topic ‘Jquery Cycle showing images from all custom posts’ is closed to new replies.