• Just installed WP-dTree and it works fine with my site’s default categories. My goal is to use it to display a custom taxonomy categories, populated with posts of a custom post type. This does not work.

    There does not seem to be any way to select post type/taxonomy in the widget settings.

    Also tried adding the template tag like so…
    wpdt_list_categories(‘post_type=myposttype&taxonomy=mytaxonomy’);
    This will display the custom taxonomy category names, but does not build the links properly, does not display the post count, and does not display post names/links.

    Am I missing something? Does this plugin not support custom post-types/taxonomy?

    Thanks for any advice.

Viewing 10 replies - 1 through 10 (of 10 total)
  • Thread Starter jharder

    (@jharder)

    Correction: Post count is working, but I cannot display post names (even with listposts=1 in my args) and the category names are not linking properly

    Plugin Author ulfben

    (@ulfben)

    WP-dTree does not support custom post-types/taxonomy. I don’t even know what they are.

    You can try and convince that it’s a worthile feature though. I recommend you start by linking me to some proper documentation explaining what they are, how they are used and what for.

    And also books. Books are very persuasive. ??

    Thread Starter jharder

    (@jharder)

    Codex page on custom taxonomy (aka custom categories) https://codex.www.ads-software.com/Taxonomies#Custom_Taxonomies

    Codex page on post types (pretty much the main attraction for WP 3.0 imo)
    https://codex.www.ads-software.com/Post_Types

    wp_list_categories has a taxonomy arg (ie taxonomy=my_taxonomy) which will return only categories from that specified category group. Works like a charm. Using the wpdt_list_categories with the same arg returns the correctly filtered category names, but the links are all written as href=mysite.com/category instead of href=mysite.com/custom-category-name

    Plugin Author ulfben

    (@ulfben)

    Interesting stuff for sure. I’ll probably take a crack at it soonish.

    As for the link-errors, try opening wp-dtree-cat.php and change the MySQL-query at line 47:
    AND {$wpdb->term_taxonomy}.taxonomy = 'category'

    To:
    AND {$wpdb->term_taxonomy}.taxonomy = $taxanomy

    And of course, make sure you’ve set the correct rewrite-argument when calling register_taxonomy.

    Plugin Author ulfben

    (@ulfben)

    Oh, and probably change all get_category_link($cat->term_id) to get_term_link($cat->term_id, $taxanomy) too.

    Thread Starter jharder

    (@jharder)

    Cool. Thanks ulfben. With your suggestion I should be able to work out the solution. I will post it here if I do.

    +1

    Thread Starter jharder

    (@jharder)

    I tried the suggestions above, but no luck. The category URLs are still not correct. Maybe the problem is in how I am registering my taxonomy? Here’s the code I’m using:

    function create_transitshare_taxonomies() {
    	register_taxonomy( 'transitshare-category', 'transitshare', array( 'hierarchical' => true, 'label' => 'transitSHARE Categories', 'rewrite' => array("slug" => "transitshare-category") ) );
    }

    That said – I think the bigger issue is getting posts from a custom post type. I tried changing the post_type from ‘post’ to ‘name of my custom post type’ in line 103 of wp-dtree-cat.php but no luck there either.

    Plugin Author ulfben

    (@ulfben)

    Yeah, I suspect this will require a fair bit of re-wiring. WordPress internal functionality is always very close but not quite what I need (for categories especially) so there’s a bunch of custom queries in there that’ll need major revisions.

    Thread Starter jharder

    (@jharder)

    No kidding! I can either get categories with posts (but no category hierarchy) or hierarchical categories (but no categories).

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘[Plugin: WP-dTree] Custom Post Type Taxonomy’ is closed to new replies.