Make Flex-Slider show only images from specific category
-
I am currently using the iMagMag theme and wish to make the 2 other pages on my website look exactly like the front page, but displaying different categories. My ‘front page’ is a news page, then the second page ‘interviews’ and the third page is ‘features’. All must look identical but are essentially 3 separate blogs / categories. (If you are interested I am doing this because some pages on my website are standard HTML5 / CSS and when any of the above options are clicked – WordPress takes over!)
I have managed to make the posts display as I wish but ……
Part of the page is their built in Flex-Slider module which scrolls based on a category set in the slider settings within admin – this is currently set to ‘news’.
I have edited the PHP to include the flex-slider on the back pages but it obviously still showed the ‘news’ images on every page. To combat this I created a new “flex-slider2.php” file and attempted to change the code within there to point at a specific category.
Any edit I make to the $data part of
'category_name' => $data['feat_slide_category']
causes the flex-slider to show images from all recent posts! The ‘news’ flex-slider continues to work as it should but the other include needs to only show posts from that category / page.This is the code for the standard ‘news’ flex-slider …. could anyone tell me:
1/ How to edit this code to show only images from the relevant category / page
2/ How I will over come the next problem …. the fact that there is only one “page.php” file (where I have included flex-slider2) but I essentially need 1 for ‘interviews’ and 1 for ‘features’ so I can show 3 seperate sliders?
<!-- .fluid_container--> <div class="fluid_container clearfix"> <!-- #camera_wrap_2 --> <div class="camera_wrap camera_orange_skin " id="camera_wrap_2"> <?php $flex_posts = new WP_Query(array( 'showposts' => 5, 'category_name' => $data['feat_slide_category'] ));?> <?php while($flex_posts->have_posts()): $flex_posts->the_post(); ?> <?php if(has_post_thumbnail()){ ?> <?php $image = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'full'); ?> <div data-thumb="<?php echo $image[0]; ?>" data-src="<?php echo $image[0]; ?>" data-link="<?php the_permalink(); ?>"> <div class="camera_caption moveFromLeft"> <div class="list-block-slide clearfix"> <h3><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h3> </div> </div> </div> <?php } ?> <?php endwhile; ?> <?php wp_reset_query();?> </div><!-- /#camera_wrap_2 --> </div> <!-- /.fluid_container --> <div style="clear:both; display:block;"></div>
This driving me crazy so any help would be greatly appreciated!
- The topic ‘Make Flex-Slider show only images from specific category’ is closed to new replies.