Title: Query Custom Post Type
Last modified: August 19, 2016

---

# Query Custom Post Type

 *  [14ner](https://wordpress.org/support/users/14ner/)
 * (@14ner)
 * [15 years, 2 months ago](https://wordpress.org/support/topic/query-custom-post-type/)
 * Hi Everyone,
 * I am currently building a hall of fame site. I created a custom post type for
   the athletes. Then I created a custom page template called Athletes where I would
   like to display a list of all of the athletes.
 * Here is my question:
 * I would like to query links to the athletes into two columns. I have a custom
   meta box with the athletes name so I would also like to use that field to sort
   the athletes alphabetically. Also the number of athletes is always changing so
   some way the query would need to first count the number of post and then divide
   by two.
 * Any help is appreciated.
 * 14ner

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [westondeboer](https://wordpress.org/support/users/poil11/)
 * (@poil11)
 * [15 years, 2 months ago](https://wordpress.org/support/topic/query-custom-post-type/#post-1989020)
 * here is an example of a query of a page i am working on right now:
    `$wp_query-
   >query('&paged='.$paged&meta_key=fb_count&order=DESC&orderby=meta_value_num');`
 * The custom field is the meta_key, in my example above it is fb_count and it orders
   is DESC which is highest to lowest. You should change orderby=meta_value_num 
   to orderby=meta_value
 *  Thread Starter [14ner](https://wordpress.org/support/users/14ner/)
 * (@14ner)
 * [15 years, 2 months ago](https://wordpress.org/support/topic/query-custom-post-type/#post-1989075)
 * Thanks for the help.
 * The code above doesn’t seem to be working though.
 * -14ner

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Query Custom Post Type’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 2 participants
 * Last reply from: [14ner](https://wordpress.org/support/users/14ner/)
 * Last activity: [15 years, 2 months ago](https://wordpress.org/support/topic/query-custom-post-type/#post-1989075)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
