WordPress.org

Ready to get started?Download WordPress

Forums

WP-dTree
adding class to post links (9 posts)

  1. ivomasterche
    Member
    Posted 2 years ago #

    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/

  2. ulfben
    Member
    Plugin Author

    Posted 2 years ago #

    Why can't you use

    .dtNode .node{
    }

    ?

  3. ivomasterche
    Member
    Posted 2 years ago #

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

  4. ulfben
    Member
    Plugin Author

    Posted 2 years ago #

    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.

  5. ivomasterche
    Member
    Posted 2 years ago #

    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.

  6. ulfben
    Member
    Plugin Author

    Posted 2 years ago #

    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?

  7. ivomasterche
    Member
    Posted 2 years ago #

    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

    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

  8. ulfben
    Member
    Plugin Author

    Posted 2 years ago #

    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.)

  9. ivomasterche
    Member
    Posted 2 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic