Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- get_template_part('templates/page', 'header');
- wp_reset_query();
- // Custom Query
- $cur_cat_id = get_cat_id(single_cat_title("", false));
- $meta_key = 'diameter';
- $orderby = 'title meta_value_num';
- $order = 'asc';
- $paged = ( get_query_var('page') ) ? get_query_var('page') : 1;
- if ( current_user_can('manage_options') ) {
- $numberposts = '30';
- // $poststatus = array('publish','future');
- $poststatus = 'publish';
- } else {
- $numberposts = '30';
- $poststatus = 'publish';
- }
- $catargs = array(
- 'post_type' => 'wheels',
- 'cat' => $cur_cat_id,
- 'post_status' => $poststatus,
- 'meta_key' => $meta_key,
- 'orderby' => $orderby,
- 'order' => $order,
- 'posts_per_page' => $numberposts,
- 'paged' => $paged
- );
- // $temp = $wp_query; // assign orginal query to temp variable for later use
- // $wp_query = null;
- $wp_query = new WP_Query($catargs);
- $countquery = $wp_query->found_posts;
- if ( $countquery > 1 ) {
- $numberwheels = 'wheels';
- } else {
- $numberwheels = 'wheel';
- }
- echo "\n";
- echo '<section id="wheellist">';
- echo "\n";
- echo '<p>Result: We have '.$countquery.' ' . $numberwheels . ' for this brand in our database, ordered by wheel name (then by diameter).</p>';
- $siteurl = home_url();
- if ( $countquery > 30 ) {
- echo "<p class=\"notex\">Please note pagination doesn't work properly (yet) for brands with more than 30 wheels, so you only see max 30 results. Please use the filter on the <a href=\"'.$siteurl.'\">frontpage</a> to show all wheels for this brand.</p>";
- }
- get_template_part('templates/loop', 'wheellist');
- // echo '<div class="footerbanner"><img src="http://placehold.it/600x100.jpg" alt="" /></div>';
- echo "\n</section>\n";
- wp_reset_query();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement