WordPress.org

Ready to get started?Download WordPress

Forums

WP-dTree
[resolved] Posts and parent category (9 posts)

  1. prz-emo
    Member
    Posted 2 years ago #

    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/

  2. ulfben
    Member
    Plugin Author

    Posted 2 years ago #

    Are you saying that POST belongs to both K and E, but WP-dTree displays it as a child of (only) the first category?

  3. prz-emo
    Member
    Posted 2 years ago #

    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 :]

  4. ulfben
    Member
    Plugin Author

    Posted 2 years ago #

    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?

  5. prz-emo
    Member
    Posted 2 years ago #

    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
    '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

  6. ulfben
    Member
    Plugin Author

    Posted 2 years ago #

    I don't think you answered my question. Is there a reason to keep POST in both E and K?

  7. prz-emo
    Member
    Posted 2 years ago #

    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.

  8. ulfben
    Member
    Plugin Author

    Posted 2 years ago #

    I'm not trying to be obtuse or anything, but I'm pretty sure 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. :)

  9. prz-emo
    Member
    Posted 2 years ago #

    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(only category 'ELEWACJE' have posts) :]

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic