WP-dTree

Description

This plugin provides dynamic navigation trees to replace the standard archives, categories, pages and link lists. They’re widgets so you can setup the awesome tree navigation with drag & drop ease, but it also exposes several new template tags for developers.

WP-dTree 4.x is a complete re-write, bringing the plugin up to speed with the much matured WordPress 3 API. The overhaul has made WP-dTree significantly more sane and robust; it supports multiple widget instances, “foreign” characters, is more in tune with your themes, plays nice with translators and offers true fallbacks for those who surf without JavaScript.

If you value my plugins, there’s several ways you can help me out;

Any help is greatly appreciated. Thanks!

//Ulf Benjaminsson

Changes in v4.4.3.1 (2015-03-20)

  • Added support for category-specific archives
  • Added support to use description instead of name for taxonomy trees.
  • Fixed the sort ordering of archives
  • Fixed potential “duplicate entry”-mysql error
  • Removed forgotten debug-call.

Changes in v4.4.2 (2015-01-03)

  • Better sorting options for posts
  • Archives now support Custom Post Types
  • Support for Post Types Order (thank you, sydcode)
  • Minor bug fixes

Changes in v4.4 (2014-12-22)

  • Added support for WordPress’ Menus.
  • Added multisite support. (thanks, John Pariseau)
  • Added option to set navigation root to the current page or category.
  • Fixed broken l10n.
  • Fixed a XSS vulnerability. (thanks, Patrick Riggs)
  • Replaced all deprecated functions.
  • Fixed tons of PHP warnings and notices.

Changes in v4.3.1 (2012-01-11)

  • Fixed: uninitialized settings will not cause wierd output.

Older changelogs moved here.
The original ‘WP-dTree’ was created by Christopher Hwang in ~2005. By 2007 Mr. Hwang seemed to have dropped of the internet for good so Ulf Benjaminsson forked the plugin in and named it ‘WP-dTree 3.0’ (note to self: having a release number in the title is stupid).

Ulf’s fork was focused on performance improvements – mainly caching – but soon expanded to add a lot of new features and modernizations; compatibility with WP 2.7 through WP 3.3, widgets, out-of-the-box Scriptaculous support, link trees, feed icons and more.

For version 4.0 the entire plugin has been rewritten from scratch by Ulf, bringing it in line with the much matured WP 3.x API and generally being less of a hack. ๐Ÿ˜›

*WP-dTree (3.0 and up) is Copyright (C) 2007-2012 Ulf Benjaminsson (email: first name at ulfben dot com)

*WP-dTree (3.x and lower) Copyright (C) 2006 Christopher Hwang (email: chris at silpstream dot com).

*dTree-JavaScript is Copyright (c) 2002-2003 Geir Landr๏ฟฝ

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

Screenshots

  • The category tree over at game.hgo.se
  • The archive widget configuration screen
  • Archives, pages and categories (with post count and RSS-icons enabled).

Installation

  1. If upgrading: disable the old version first!
  2. Transfer the ‘wp-dtree-30’ folder to the /wp-content/plugins/ directory
  3. Activate the plugin through the ‘Plugins’ menu in WordPress
  4. Go to the ‘WP-dTree’ under ‘Settings’ to adjust your preferences
  5. Go to ‘Presentation’ -> ‘Widgets’ and drag-n-drop the widgets to the relevant section of your sidebar(s)
  6. Configure the active Widget to your liking
  7. Styling is done through CSS

For developers

WP-dTree exposes the following template tag functions:

  • wpdt_list_archives();
  • wpdt_list_categories();
  • wpdt_list_taxonomies(); //needs testing.
  • wpdt_list_menu(); //needs testing
  • wpdt_list_pages();
  • wpdt_list_links();
  • wpdt_list_bookmarks(); //alias for wpdt_list_links

They function a lot like WordPress own wp_list_* functions:

  • They take an (optional) query-string or associative array with arguments
  • They print by default, but if passed ‘echo=0’ they return the string of markup
  • Most of them use the WordPress namesake for generating noscript-content

Here’s an example:

    <div class="dtree">
        <?php
            if(function_exists('wpdt_list_archives')){          
                wpdt_list_archives('type=yearly&useicons=1');
            }
        ?>
    </div>

I’ve tried to keep the same argument-lists as the WordPress “equivalents” but there are some discrepancies: style- and markup related arguments are not applicable to WP-dTree (but gets passed through for the noscript content).
There is also some inconsistency within WordPress, like some methods takes sortby while others takes sort_column. I’ve tried for WP-dTree to accept both but I’m sure I’ve missed a bunch of these cases.

So, to find out what arguments are definetly available grab the default $args:

  • wpdt_get_archives_defaults();
  • wpdt_get_categories_defaults();
  • wpdt_get_taxonomies_defaults()
  • wpdt_get_pages_defaults();
  • wpdt_get_links_defaults();
  • wpdt_get_menu_defaults();

They all return associative arrays whith all arguments defaulted.

FAQ

Installation Instructions
  1. If upgrading: disable the old version first!
  2. Transfer the ‘wp-dtree-30’ folder to the /wp-content/plugins/ directory
  3. Activate the plugin through the ‘Plugins’ menu in WordPress
  4. Go to the ‘WP-dTree’ under ‘Settings’ to adjust your preferences
  5. Go to ‘Presentation’ -> ‘Widgets’ and drag-n-drop the widgets to the relevant section of your sidebar(s)
  6. Configure the active Widget to your liking
  7. Styling is done through CSS

For developers

WP-dTree exposes the following template tag functions:

  • wpdt_list_archives();
  • wpdt_list_categories();
  • wpdt_list_taxonomies(); //needs testing.
  • wpdt_list_menu(); //needs testing
  • wpdt_list_pages();
  • wpdt_list_links();
  • wpdt_list_bookmarks(); //alias for wpdt_list_links

They function a lot like WordPress own wp_list_* functions:

  • They take an (optional) query-string or associative array with arguments
  • They print by default, but if passed ‘echo=0’ they return the string of markup
  • Most of them use the WordPress namesake for generating noscript-content

Here’s an example:

    <div class="dtree">
        <?php
            if(function_exists('wpdt_list_archives')){          
                wpdt_list_archives('type=yearly&useicons=1');
            }
        ?>
    </div>

I’ve tried to keep the same argument-lists as the WordPress “equivalents” but there are some discrepancies: style- and markup related arguments are not applicable to WP-dTree (but gets passed through for the noscript content).
There is also some inconsistency within WordPress, like some methods takes sortby while others takes sort_column. I’ve tried for WP-dTree to accept both but I’m sure I’ve missed a bunch of these cases.

So, to find out what arguments are definetly available grab the default $args:

  • wpdt_get_archives_defaults();
  • wpdt_get_categories_defaults();
  • wpdt_get_taxonomies_defaults()
  • wpdt_get_pages_defaults();
  • wpdt_get_links_defaults();
  • wpdt_get_menu_defaults();

They all return associative arrays whith all arguments defaulted.

WP-dTree looks horrible on my blog and I hate you for it!

WP-dTree 4.0 has almost no styles of its own – it inherits from your theme. To help you apply your own styling I’ve included a template CSS-file. Open wp-dtree.css and copy all the selectors into your theme’s stylesheet.
Now disable the plugins default CSS (from the Settings-panel) and hack away at your own file to make it pretty.

Remember – do not edit wp-dtree.css, as this will be replaced on every update of the plugin.

Can I help you in any way?

Absolutely! If value my plugins, please consider sending me a book or two. (used are fine!)

Or perhaps some games on Steam. ๐Ÿ™‚

Why is there no “Show more”-link for Archives?

First: a simple workaround is to use ‘Folders are links’ and ‘Show post count’. This way a visitor can easily see that a folder has more content than is on display, and clicking the folder name will bring her to it.

The reason there’s no “Show more”-link for Archives is this: limit posts in categories was a paid request and I added that feature to archives too because it was reasonably simple and actually helped me optimize the code slightly. The “show more”-link was a simple addon for the Category generation code, but not so for Archives – it simply requires a lot of data to be available where it currently is not. So until someone feels strongly enough to pay me for the inconvenience, I won’t bother bloating the code for this rather narrow feature.

Can I change the images used by WP-dTree?

The images are all stored in the ‘wp-dtree/dtree-img/’ directory. You can change them if you like. Just remember to keep the names the same or they won’t appear.

Reviews

WP-dTree is amazing and Ingenious

WP-dTree is amazing, useful and ingenious: has wonderful features and no deprecated and unsafe code (after correction for PHP7: https://wordpress.org/support/topic/php7-wpdt_links_widget-has-a-deprecated-constructor/#post-9196525).
I am using it from WP4.0 to WP4.7.5 with very many other plugins and it works OK.
Great thanks for this genius plugin!!!

Was very happy with this…

Not updated for quite some time, but still there is no viable replacement for this wonderful plugin. Works no problem with multi-byte characters (I’m using it in a Japanese site: blog.tedama.co.jp).

If you are using JS optimization, make sure to exclude “wp-dtree-30/wp-dtree.min.js”, as WP-d Tree will not like it. I first thought that it wasn’t compatible with the newer versions of WordPress, but it IS.

Exactly What I was looking for

This is the plug in I was looking for to create a easy to navigate, left sidebar menu of my Parent categories, subcategories and grandchildren categories. Do you know if there is a capacity to how large this can be? Do you have any upgrades available, like CSS styling? Thank You.

Read all 19 reviews

Contributors & Developers

“WP-dTree” is open source software. The following people have contributed to this plugin.

Contributors

Translate “WP-dTree” into your language.

Interested in development?

Browse the code, check out the SVN repository, or subscribe to the development log by RSS.

Changelog

(Older entries moved here to clear up the front page)

Changes in v4.4 (2014-12-22)

  • Added support for WordPress’ Menus.
  • Added multisite support. (thanks, John Pariseau)
  • Added option to set navigation root to the current page or category.
  • Fixed broken l10n.
  • Fixed a XSS vulnerability. (thanks, Patrick Riggs)
  • Replaced all deprecated functions.
  • Fixed tons of PHP warnings and notices.

Changes in v4.3.1 (2012-01-11)

  • Fixed fallbacks for uninitialized settings: never print wierd output.

Changes in v4.3 (2012-01-01)

Changes in v4.2 (2010-10-29)

  • Fixed the uninstallation procedure.

Changes in v4.1 (2010-10-23)

Changes in v4.0 (2010-10-17)

  • Completely recoded from the ground up for a much needed code overhaul.
  • All previous settings will be lost! Write them down before upgrading.
  • Added: support for multiple tree instances
  • Added: support for per-tree configurations
  • Added: template tags for theme developers
  • Added: (optional) noscript for JS-disabled visitors
  • Added: uses category descriptions for link titles
  • Added: translation support
  • Added: optional JS-escape (XHTML, HTML or none) to ease validation
  • Added: caching is optional (per instance, to boot)
  • Fixed: should properly encode quotes and HTML-entities
  • Replaced Scriptacolous with jQuery
  • Made truncation optional
  • Removed support for WP <2.3
  • Removed all CSS-options from admin area
  • Removed all non-essential CSS-rules
  • Only load jQuery if animation is on
  • Minified JS and CSS (9KB vs. 16KB!)
  • Cache is created on site visit (faster admin, less server load)

Known issues in 4.0:

  • This is a true .0 release – please explore and play with all the settings. Let me know when something breaks (provide links!).
  • Only tested in Chrome
  • opentoselection doesn’t handle paging

Changes in v3.5 (2008-11-26)

  • New option: “shut down unused trees” (performance!)
  • New option: “force open to”
  • New option: per-tree truncation setting
  • New option: custom sort order for archives
  • New option: custom sort order for posts in categories
  • New option: exclude posts from category tree
  • New option: more CSS options avaliable from the admin
  • Added: widget preview in the admin area
  • Added: link target attributes in link tree
  • Added: path defines to support non-standard WP-installations
  • Added: uninstall.php for nice WP 2.7 plugin cleanup.
  • Fixed: include sub-categories when counting posts
  • Fixed: “close same level”
  • Fixed: Quotes “” in titles breaks alt-texts
  • Fixed: Nestled cats get excluded if parent is empty
  • Fixed: RSS-icons don’t show in IE
  • Fixed: Unwanted spacing in IE
  • Misc: improved admin screen feng-shui.
  • Misc: Moved config screen to “settings”-section of admin
  • Misc: CSS should be a bit more robust now

Changes in v3.4.2 (2008-10-19)

Changes in v3.4.1 (2008-07-20)

Changes in v3.4 (2008-07-12)

  • Added support for link trees. (needs testing!)
  • Fixed breakage in WP 2.5, 2.6
  • Fixed invalid XHTML output. (props: jberghem)
  • Fixed a CSS-issue. (props: wenzlerm)
  • Renamed the dTree script to avoid collisions with plugins using an unmodified version.

Changes in v3.3.2 (2007-11-26)

  • Fixed bug with excluding multiple categories.

Changes in v3.3.1 (2007-11-02)

  • Removed redundant li-tags from widgets. (props: Alexey Zamulla)
  • Support for non-ascii characters. (props: michuw)
  • Properly encoded ampersands (&) in javascript URLs.

Changes in v3.3 (2007-10-26)

  • Optimized the dtree script, up to 40% less data required to feed the script. Using dTree now generates less markup than normal HTML.
  • New option: Show RSS icon for archives
  • New option: Show post count for archives
  • Fix: Open to requested node
  • Fix: images URL not working on some servers (props: Zarquod)
  • Fix: somewhat more IE compatible…

Known issues: RSS icons wont show in IE if post count is on.

Changes in v3.2 (2007-10-15)

  • Support for WP’s bundled scriptacolous library! (turn effects on in the WP-dTree options page)
  • New cache structure reduces cache size with ~33% compared to previous implementations.
  • New option: Show RSS icon for categories
  • New option: Show post count for categories
  • New option: Effect duration

Regressions: open to selection is broken again. It’ll be back in the next version, but if it’s vital for you, stay with 3.1

Changes in v3.1: (2007-10-06)

  • Updated to comply with WordPress 2.3’s new taxonomy tables for categories.
  • Widgetized! You no longer need to edit your sidebar manually.
  • Fixed “Open To Selection”-option.

Changes in v3.0: (2007-08-17)

  • Forked from the dead WP-dTree 2.0
  • Added caching. The plugin creates the trees (only) when blog content changes, instead of creating them on every visit. Displaying the front page on the dev site went from 411 queries to 18. ๐Ÿ™‚