Support » Fixing WordPress » Select Top Post from Post Type Taxonomies

  • Resolved wilhud


    I’m trying to do the following…

    I have multiple collections (cars, scooters, bicycles, etc.) that I want to setup on my site. Once setup, I want to have a page that lists these collection types with a sample image of one scooter, one bicycle and so on. Ideally it would be the last item added for each collection type. When clicked, the user will be taken to the complete list of items in that collection type.

    My first instinct was to create the Post_type called collections. I did so and then added a taxonomy called type in which I added cars, scooters and such. This works great and I can easily pull the lists for each collection type. However, I’m wondering how do I generate the main collections page where it shows one example of each type?

    I tried the following…

    $loop = new WP_Query( array( 'post_type' => 'collection', 'taxonomy' => 'type', 'posts_per_page' => 10 ) );

    But that was just a shot in the dark and didn’t return any results.

    Any assistance is greatly appreciated.


Viewing 2 replies - 1 through 2 (of 2 total)
  • There are a couple of options shown on this page.

    Thanks vtxyzzy, I had actually ended up coding something similar to the Show 1 Post/Category option that you linked. It seems to work pretty well. Glad I checked your link though because I had forgotten the ‘post_status’ => ‘publish’ part.


Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Select Top Post from Post Type Taxonomies’ is closed to new replies.