Title: [Plugin: WP-dTree] Posts and parent category
Last modified: August 20, 2016

---

# [Plugin: WP-dTree] Posts and parent category

 *  Resolved [prz-emo](https://wordpress.org/support/users/prz-emo/)
 * (@prz-emo)
 * [14 years, 1 month ago](https://wordpress.org/support/topic/plugin-wp-dtree-posts-and-parent-category/)
 * Hi, i have a problem with this plugin. I’ve got categories like this:
    Offer -
   E_category –K_category –KN_category
 * My post is in categories: Offer, E_category, K_category.
    Wordpress sorts posts
   categories by name(alphabetic), so WP-dTree shows: Offer -E_category –K_category–
   POST
 * How can i make WP-dTree to shows my posts like this:
    Offer -E_category –K_category—
   POST
 * Is it possible?
 * [http://wordpress.org/extend/plugins/wp-dtree-30/](http://wordpress.org/extend/plugins/wp-dtree-30/)

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

 *  Plugin Author [ulfben](https://wordpress.org/support/users/ulfben/)
 * (@ulfben)
 * [14 years ago](https://wordpress.org/support/topic/plugin-wp-dtree-posts-and-parent-category/#post-2720138)
 * Are you saying that POST belongs to both K and E, but WP-dTree displays it as
   a child of (only) the first category?
 *  Thread Starter [prz-emo](https://wordpress.org/support/users/prz-emo/)
 * (@prz-emo)
 * [14 years ago](https://wordpress.org/support/topic/plugin-wp-dtree-posts-and-parent-category/#post-2720140)
 * Yes. When I look at the post in admin panel there are both of categories(K, E)
   but sort by name, so the first category is E.
 * I’ve written my own code without ajax and it works :]
 *  Plugin Author [ulfben](https://wordpress.org/support/users/ulfben/)
 * (@ulfben)
 * [14 years ago](https://wordpress.org/support/topic/plugin-wp-dtree-posts-and-parent-category/#post-2720154)
 * You say your POST is in categories Offer, E and K. These are nested like
 * Offer
    Offer->E Offer->E->K
 * Why is the POST in all of them, and not *only* in K?
 *  Thread Starter [prz-emo](https://wordpress.org/support/users/prz-emo/)
 * (@prz-emo)
 * [14 years ago](https://wordpress.org/support/topic/plugin-wp-dtree-posts-and-parent-category/#post-2720157)
 * The POST is one of products from offer. My client want, that in sidebar is list
   of all categories:
    -you click on E category and the script shows all subcategories
   or, if doesn’t exist all post from this categegory, -next, you click on K category
   and you see all posts from this category.
 * This should look like this:
    [click](http://img7.imagebanana.com/img/9yt202wx/screen.png)‘
   Elewacja’ is the E category ‘Kamień regularny’, ‘Kamień nieregularny’ are K category‘
   Słońce Bałkanów’, ‘Słońce Adriatyku’ etc. are POSTS category
 *  Plugin Author [ulfben](https://wordpress.org/support/users/ulfben/)
 * (@ulfben)
 * [14 years ago](https://wordpress.org/support/topic/plugin-wp-dtree-posts-and-parent-category/#post-2720160)
 * I don’t think you answered my question. Is there a reason to keep POST in both
   E and K?
 *  Thread Starter [prz-emo](https://wordpress.org/support/users/prz-emo/)
 * (@prz-emo)
 * [14 years ago](https://wordpress.org/support/topic/plugin-wp-dtree-posts-and-parent-category/#post-2720174)
 * Yes, if you are in Offer in content you see all of products – with pagination.
   When you select E from the submenu, in the content you see products only from
   E category etc.
 * When i put POST into K, you go to offer and don’t see it.
 *  Plugin Author [ulfben](https://wordpress.org/support/users/ulfben/)
 * (@ulfben)
 * [14 years ago](https://wordpress.org/support/topic/plugin-wp-dtree-posts-and-parent-category/#post-2720179)
 * I’m not trying to be obtuse or anything, but [I’m pretty sure](http://codex.wordpress.org/Class_Reference/WP_Query#Category_Parameters)
   something like
    `$query = new WP_Query( 'category_name=Offer' );` Would yield
   all posts in Offer or subcategories.
 * So (unless I’m mistaken) this should be a fairly simple update to your theme,
   rather than a new feature of WP-dTree.
 * `<?php if ($query->have_posts()) : while ($query->have_posts()) : $query->the_post();?
   >`
 * … and you know the rest. 🙂
 *  Thread Starter [prz-emo](https://wordpress.org/support/users/prz-emo/)
 * (@prz-emo)
 * [14 years ago](https://wordpress.org/support/topic/plugin-wp-dtree-posts-and-parent-category/#post-2720182)
 * LOL. I’ve thought that this:
    `$query = new WP_Query( 'category_name=Offer' );`
   shows posts only from Offer but not from subcategoies.
 * My mistake. Thanks a lot! :]
 * If you’re intrested, you can check how my code works [here](http://projekty.mirota.pl/erakamienia/wordpress/oferta)(
   only category ‘ELEWACJE’ have posts) :]

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

The topic ‘[Plugin: WP-dTree] Posts and parent category’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/wp-dtree-30_fcfcf8.svg)
 * [WP-dTree](https://wordpress.org/plugins/wp-dtree-30/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-dtree-30/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-dtree-30/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-dtree-30/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-dtree-30/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-dtree-30/reviews/)

## Tags

 * [WP-dTree 3.0](https://wordpress.org/support/topic-tag/wp-dtree-3-0/)

 * 8 replies
 * 2 participants
 * Last reply from: [prz-emo](https://wordpress.org/support/users/prz-emo/)
 * Last activity: [14 years ago](https://wordpress.org/support/topic/plugin-wp-dtree-posts-and-parent-category/#post-2720182)
 * Status: resolved