Problem Building Image Slider
-
Yea, I know I can just download a plug-in, but I’m trying to improve my development skills. What I’m trying to do is set up an image slider of just pictures from posts that belong to a certain category. I started out using this tutorial: Building A Custom Image Slider. I am using the code from this tutorial which I believe is pretty basic:
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); $args = array( 'post_type' => 'attachment', 'numberposts' => -1, 'orderby'=> 'menu_order', 'order' => 'ASC', 'post_mime_type' => 'image', 'post_status' => null, 'post_parent' => $post->ID ); $attachments = get_posts( $args ); if ( $attachments ) { foreach ( $attachments as $attachment ) { echo wp_get_attachment_image($attachment->ID , 'full' ); } } endwhile; endif; ?>I thought that I could just take this code and add the ‘category’ parameter for the category of the posts that I want to pull the images from. In this case it would be ‘category’ => 9. This is the part that’s got me very confused… without the category parameter all of the attached images from all posts (I believe) are being displayed. When I add the category (which is the correct id #), no images are displayed.
Maybe I’m using the wrong technique, but I’d appreciate any sort of feedback to give me more direction.
Thank You,
Sean
The topic ‘Problem Building Image Slider’ is closed to new replies.