Post Order of a Custom Post Type Using a custom meta box
-
I created a custom post type and custom taxonomy. Each post type is used to display an image for an infinite carousel. I have everything working correctly in terms of displaying correctly and pulling the correct posts. However I would like to be able to display the post in different orders depending upon the # given in the custom meta box field and the template page calling that query. Below is an example of the loop code that I have been using
<!-- BEGIN .infiniteCarousel --> <div class="infiniteCarousel"> <!-- BEGIN .wrapper --> <div class="wrapper"> <ul> <?php global $post; $featuredPosts = new WP_Query(array('post_type' => 'slider', 'crs_slider' => 'crs-safety-slider', 'posts_per_page' => '-1', 'meta_key' => $custom['safety_order'][0], 'orderby' => 'meta_value_num', 'order' => 'DESC')); while ($featuredPosts->have_posts()) : $featuredPosts->the_post(); $custom = get_post_custom($post->ID); $small_image = $custom["small_image"][0]; $large_image = $custom["large_image"][0]; $image_title = $custom["image_title"][0]; $image_alt = $custom["image_alt"][0]; ?> <li> <a rel="prettyPhoto[carousel]" href="<?php echo $large_image; ?>" class="slider-item"> <img title="<?php echo $image_title; ?>" alt="<?php echo $image_alt; ?>" src="<?php echo $small_image; ?>" /> </a> </li> <?php endwhile; ?> </ul> <!-- END .wrapper --> </div> <!-- END .infiniteCarousel --> </div>
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Post Order of a Custom Post Type Using a custom meta box’ is closed to new replies.