Title: [Plugin: WP-dTree] adding class to post links
Last modified: August 20, 2016

---

# [Plugin: WP-dTree] adding class to post links

 *  [ivomasterche](https://wordpress.org/support/users/ivomasterche/)
 * (@ivomasterche)
 * [14 years, 4 months ago](https://wordpress.org/support/topic/plugin-wp-dtree-adding-class-to-post-links/)
 * Hello,
 * I think this is a great plugin but I would like to suggest to add a different
   class, to the post’s links.
 * This is going to be very useful for changing post’s links css.
 * Currently i am using jQuery to put the post content dinamically after the post
   link and such post_link class will make thinks easier.
 * [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, 4 months ago](https://wordpress.org/support/topic/plugin-wp-dtree-adding-class-to-post-links/#post-2524181)
 * Why can’t you use
 *     ```
       .dtNode .node{
       }
       ```
   
 * ?
 *  Thread Starter [ivomasterche](https://wordpress.org/support/users/ivomasterche/)
 * (@ivomasterche)
 * [14 years, 4 months ago](https://wordpress.org/support/topic/plugin-wp-dtree-adding-class-to-post-links/#post-2524182)
 * Because as far as i can see the category links are .dtNode .node too …
 * And i would like to now which link is category and which is post…
 *  Plugin Author [ulfben](https://wordpress.org/support/users/ulfben/)
 * (@ulfben)
 * [14 years, 3 months ago](https://wordpress.org/support/topic/plugin-wp-dtree-adding-class-to-post-links/#post-2524254)
 * I don’t believe that’s possible.
 * What you call a “category” is just a parent node, and _all_ nodes are just links
   to dtree. A parent node might be a category, but it might just as well be a page
   or some custom taxonomy.
 *  Thread Starter [ivomasterche](https://wordpress.org/support/users/ivomasterche/)
 * (@ivomasterche)
 * [14 years, 3 months ago](https://wordpress.org/support/topic/plugin-wp-dtree-adding-class-to-post-links/#post-2524256)
 * Ok you have done a great job with this plugin and i didn’t have the time to look
   in the code so you must be right.
 * The only thing that i can add is that you give different id to the different 
   nodes – i noticed – dcat###, jcat###, scat### so i thought that you can give 
   them different class too…
 * I actualy used jQuery to check if the id of the node starts with “scat” which
   i noticed is used for the nodes that are posts in my case, so i can add some 
   additional functionality to these nodes.
 * Once again you’ve done a great job, i just wanted to propose something that i
   thought would be useful.
 *  Plugin Author [ulfben](https://wordpress.org/support/users/ulfben/)
 * (@ulfben)
 * [14 years, 3 months ago](https://wordpress.org/support/topic/plugin-wp-dtree-adding-class-to-post-links/#post-2524257)
 * Indeed it does give different IDs. I checked it out and this is what I gather
 * **j:** seems to be DOM-nodes related to the tree controls (plus/minus signs)
   **
   d:** seems so be the DOM-nodes containing block of nodes that hide/appear together**
   s:** seems to be all links (posts, categories, archives – all of them)
 * So yeah; there are different IDs, but the script is still not aware of what they’re
   pointing to.
 * Now – the script is obviously able to separate “folders” from “files” (eg. nodes).
   Unfortunately that distiction is made much later than the class/id assignment
   so it would take a fair bit of hacking around to retrofit a “file”-class into
   the anchor surrounding the icon. And I’m not sure the icons truly matches your
   definition of a post vs. category node either?
 *  Thread Starter [ivomasterche](https://wordpress.org/support/users/ivomasterche/)
 * (@ivomasterche)
 * [14 years, 3 months ago](https://wordpress.org/support/topic/plugin-wp-dtree-adding-class-to-post-links/#post-2524258)
 * I guess we can close this case, but if you have 5 minutes you can see the way
   i implemented your plugin –
 * [http://intelligames.bg/tournaments/q-and-a](http://intelligames.bg/tournaments/q-and-a)
 * The site is in bulgarian, but i hope, that you’ll get the idea.
 * As i said earlier i used that different ID structure with jquery, so i got the
   functionality i needed – to load the post content dynamically, and to have a 
   slightly different behavior.
    The styling is nor perfect but the site is still
   in development.
 * Once again thank you for your plugin
 *  Plugin Author [ulfben](https://wordpress.org/support/users/ulfben/)
 * (@ulfben)
 * [14 years, 3 months ago](https://wordpress.org/support/topic/plugin-wp-dtree-adding-class-to-post-links/#post-2524259)
 * That’s a pretty cool use case. Not at all what I imagined when you said you put
   post content next to the links. I’m sure there are a lot simpler ways to implement
   a FAQ with toggle functionality, but still – this is an excellent hack! Good 
   job!
 * I’m sure you’ve thought off this already, but it would be trivial to use jQuery
   to check how many indentation sprites are used for the post node, and duplicate
   them for the faq_content. Thus keeping the content aligned with the header-link.
 * I’ll keep this request in the back of my mind when I go through the script next
   time (adding some more contextual “tags” to the tree output would be useful anyway),
   but I’m fairly sure your jQuery-selection is the best solution to this particular
   problem.
 * (and I love the Settlers of Catan boardgame. Especially with all the cool expansions
   as of late.
 * I played (rather poorly) in the Swedish National Tournament five- or six years
   ago. 🙂 Great stuff.)
 *  Thread Starter [ivomasterche](https://wordpress.org/support/users/ivomasterche/)
 * (@ivomasterche)
 * [14 years, 3 months ago](https://wordpress.org/support/topic/plugin-wp-dtree-adding-class-to-post-links/#post-2524260)
 * Thank you.
 * I’ve checked some other solutions, but still i liked your most.
    I’m an engineer–
   i like to make things the complex way 🙂
 * And yes some additional styling is coming on the way.

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

The topic ‘[Plugin: WP-dTree] adding class to post links’ 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: [ivomasterche](https://wordpress.org/support/users/ivomasterche/)
 * Last activity: [14 years, 3 months ago](https://wordpress.org/support/topic/plugin-wp-dtree-adding-class-to-post-links/#post-2524260)
 * Status: not a support question