---
description: >-
  https://stackoverflow.com/questions/19719469/display-page-of-custom-post-type-taxonomy-in-wordpress
---

# Display page of custom post type taxonomy in Wordpress (ok)

0

Alright, so what I have is a Wordpress theme with a custom post type (listing) and custom taxonomies under that already built in. I've successfully added my own custom taxonomy (new-developments) under the existing custom post type.

I have also setup a custom template for the new taxonomy titled taxonomy-new-developments.php which functions as well, however, when attempting to get just those custom post types with the taxonomy "new-developments" displayed on their own pages I get all the posts with the custom post type "listing".

Here is my code:

customposttypes.php -

```
add_action('init', 'property_new_dev_taxonomies');
function property_new_dev_taxonomies() {
register_taxonomy('new-developments',
        'listing',
        array (
        'labels' => array (
                'name' => 'New Developments',
                'singluar_name' => 'New Developments',
                'search_items' => 'Search New Developments',
                'popular_items' => 'Popular New Developments',
                'all_items' => 'All New Developments',
                'parent_item' => 'Parent New Development',
                'parent_item_colon' => 'Parent New Development:',
                'edit_item' => 'Edit New Development',
                'update_item' => 'Update New Development',
                'add_new_item' => 'Add New Development',
                'new_item_name' => 'New Developments',
        ),
                'hierarchical' => true,
                'show_ui' => true,
                'show_tagcloud' => true,
                'rewrite' => array( 'slug' => 'new-developments'),
                'query_var' => 'new-developments',
                'public'=>true)
        );
}
```

the call in my taxonomy-new-developments.php

```
<?php $posts = new WP_Query( array(
    'post_type' => 'listing', 'new-developments' 
    ) 
); ?>
```

Any assistance in this matter would be greatly appreciated!

EDIT: something I left out, which is key to this issue is that the desired result is a page that displays the "new-developments" in a list (this works as you can see [here](http://citymiamihomes.com/new-developments/) )

Moving down the cascade of locations is where I have the problem, clicking on "Doral" which has one listing active brings up the problem page where all posts under the "listing" custom post type are displayed. This is what I need to figure out how to filter out to only display those under the "taxonomy" "location".[php](https://stackoverflow.com/questions/tagged/php)[wordpress](https://stackoverflow.com/questions/tagged/wordpress)[custom-post-type](https://stackoverflow.com/questions/tagged/custom-post-type)[taxonomy](https://stackoverflow.com/questions/tagged/taxonomy)[Share](https://stackoverflow.com/q/19719469)Follow[edited Nov 1 '13 at 15:56](https://stackoverflow.com/posts/19719469/revisions)asked Nov 1 '13 at 1:32[![](https://www.gravatar.com/avatar/96d569050cb944f40dcc2a2d94b63870?s=32\&d=identicon\&r=PG\&f=1)](https://stackoverflow.com/users/1028692/red-zephyr-design)[Red Zephyr Design](https://stackoverflow.com/users/1028692/red-zephyr-design)10144 silver badges1313 bronze badges

* What are the terms that you want in this "new development" taxonomy? – [Chris Herbert](https://stackoverflow.com/users/1667136/chris-herbert) [Nov 1 '13 at 3:02](https://stackoverflow.com/questions/19719469/display-page-of-custom-post-type-taxonomy-in-wordpress#comment29296755_19719469)
* @ChrisHerbert what I need to have is the "new developments" taxonomy display any of the current or future added children, currently they are "doral" and "brickell". So the filter that I have just showing the all of the "new developments" is working properly, it's when I get down to the next level to the city filters that it's not working and just including everything from the "listing" custom post type. Sorry, this rather changes things, I am learning more about the problem as I'm moving along. Thanks in advance for any help. – [Red Zephyr Design](https://stackoverflow.com/users/1028692/red-zephyr-design) [Nov 1 '13 at 15:46](https://stackoverflow.com/questions/19719469/display-page-of-custom-post-type-taxonomy-in-wordpress#comment29313484_19719469)&#x20;
* Reviewing this over the weekend and I've come to the realization that I'm not quite sure what the relation is between the taxonomy of **"new-developments" > "doral"**. Would it simply be a sub-category of the parent category? Whatever the terminology, this is the "item" that I am in need of isolating on the results page so as to get only the listings for Doral under the New Developments category. Again, any help is greatly appreciated. Thanks. – [Red Zephyr Design](https://stackoverflow.com/users/1028692/red-zephyr-design) [Nov 4 '13 at 15:13](https://stackoverflow.com/questions/19719469/display-page-of-custom-post-type-taxonomy-in-wordpress#comment29384090_19719469)

[Add a comment](https://stackoverflow.com/questions/19719469/display-page-of-custom-post-type-taxonomy-in-wordpress)

### 1 Answer

[Active](https://stackoverflow.com/questions/19719469/display-page-of-custom-post-type-taxonomy-in-wordpress?answertab=active#tab-top)[Oldest](https://stackoverflow.com/questions/19719469/display-page-of-custom-post-type-taxonomy-in-wordpress?answertab=oldest#tab-top)[Votes](https://stackoverflow.com/questions/19719469/display-page-of-custom-post-type-taxonomy-in-wordpress?answertab=votes#tab-top)2

try with this code:

```
<?php
$type = 'New Developments';
$args=array(
  'post_type' => $type,
  'post_status' => 'publish',
  'posts_per_page' => -1,
  'caller_get_posts'=> 1
);
$my_query = null;
$my_query = new WP_Query($args);
if( $my_query->have_posts() ) {
  while ($my_query->have_posts()) : $my_query->the_post(); ?>
    <p><a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></p>
    <?php
  endwhile;
}
wp_reset_query();  // Restore global post data stomped by the_post().
?>
```

Or go through this link:

[Custom Taxonomy Filtering with Wordpress](https://stackoverflow.com/questions/19490762/custom-taxonomy-filtering-with-wordpress/19491604#19491604)

Thanks[Share](https://stackoverflow.com/a/19721537)Follow[edited May 23 '17 at 10:25](https://stackoverflow.com/posts/19721537/revisions)[![](https://www.gravatar.com/avatar/a007be5a61f6aa8f3e85ae2fc18dd66e?s=32\&d=identicon\&r=PG)](https://stackoverflow.com/users/-1/community)[Community](https://stackoverflow.com/users/-1/community)♦111 silver badgeanswered Nov 1 '13 at 5:54[![](https://www.gravatar.com/avatar/056e5f19728a7d88da0d6aacb9247cdb?s=32\&d=identicon\&r=PG\&f=1)](https://stackoverflow.com/users/2834245/krunal-shah)[Krunal Shah](https://stackoverflow.com/users/2834245/krunal-shah)2,00399 silver badges2727 bronze badges

* I attempted to use your code however I ran into an error on line 9. Not being a php developer I attempted to fix it, and while I removed the error the code would not generate any results. – [Red Zephyr Design](https://stackoverflow.com/users/1028692/red-zephyr-design) [Nov 1 '13 at 15:48](https://stackoverflow.com/questions/19719469/display-page-of-custom-post-type-taxonomy-in-wordpress#comment29313581_19721537)
* I ran the code here: \[link][phpcodechecker.com/\[/link\]](http://phpcodechecker.com/\[/link]) and this is the error it displayed: Error: There is 1 more opening parenthesis '(' than expected PHP Syntax Check: Parse error: syntax error, unexpected T\_VARIABLE, expecting ')' in your code on line 9 $my\_query = null; – [Red Zephyr Design](https://stackoverflow.com/users/1028692/red-zephyr-design) [Nov 1 '13 at 15:50](https://stackoverflow.com/questions/19719469/display-page-of-custom-post-type-taxonomy-in-wordpress#comment29313647_19721537)
* It's missing a closing parenthesis on line 8. – [Chris Herbert](https://stackoverflow.com/users/1667136/chris-herbert) [Nov 1 '13 at 16:23](https://stackoverflow.com/questions/19719469/display-page-of-custom-post-type-taxonomy-in-wordpress#comment29314861_19721537)
* @ChrisHerbert thanks for pointing that out, I did end up figuring out what the matter was but it didn't change the outcome of the code. Still got no results. – [Red Zephyr Design](https://stackoverflow.com/users/1028692/red-zephyr-design) [Nov 1 '13 at 20:12](https://stackoverflow.com/questions/19719469/display-page-of-custom-post-type-taxonomy-in-wordpress#comment29321478_19721537)

[Add a comment](https://stackoverflow.com/questions/19719469/display-page-of-custom-post-type-taxonomy-in-wordpress)
