• Hi!

    I am trying to sort destinations (post type destination) by category.

    echo "Category ID: ".$category;
    
          $paged = get_query_var( 'paged' ) ? absint( get_query_var( 'paged' ) ) : 1;
            $args = array(
              'post_type' => 'destination',
              'posts_per_page' => $destinations_two_number,
              'order' => $orderpost,
              'orderby' => $orderby,
              'paged' => $paged,
              'cat' => $category
            );
            $wp_query = new WP_Query($args);
            while ($wp_query -> have_posts()) : $wp_query -> the_post();
            global $product;
            $params = array( 'width' => 555, 'height' => 370 );
            $image_thumbnail = bfi_thumb( wp_get_attachment_url(get_post_thumbnail_id()), $params );

    Unfortunately I do not get any output. This http://visitadria.kreativkessel.com/destination/villa-lilli/ post should be definitly part of the cat 21!

    Have I defined sth wrong in the code? Thank you for your help.

    kind regards.

The topic ‘WP_Query Cat parameter’ is closed to new replies.