WordPress.org

Ready to get started?Download WordPress

Forums

WordPress MooTools Tree Creator
[resolved] Attach PDFs? (3 posts)

  1. Josh Fialkoff
    Member
    Posted 1 year ago #

    I am using this plugin to make a repository of files for a company intranet.
    I see that I can attach an image to a branch. How can I add a PDF?
    Thanks,
    Josh

    http://wordpress.org/extend/plugins/wp-moo-tree/

  2. dunar21
    Member
    Plugin Author

    Posted 1 year ago #

    Sorry, I did not respond right away, I would have thought these questions would be directed to my email. Anyway, the answer to your questions is all in the javascript.

    The mootree library comes with several event handlers. The documentation is located in Settings>WP MooTree>Categories(tab)>under "Customize Javascript" bullet point.

    The event handler being used is the onSelect. In order to open a url instead of an image, you can simply remove the milkbox call and replace it with a simple javascript call to window.open.

    The url that you place into the specific branch is accessed by way of node.data.url. Other relevant data access calls are listed in the documentation.

    So, to change the javascript to fit your purpose, simply locate this function relative to the specific tree category you wish to apply the new functionality:

    onSelect: function(node, state) {
    if (state){
    if(typeof(node.data.url) ==  "string" && node.data.url != "" ){
      //HERE IS WHERE YOU WOULD PUT YOUR CODE FOR THIS ONSELECT FUNCTION
     //maybe something like this: window.open(node.data.url,'_blank');
    }}}

    That's it. Hope this helps.

  3. Josh Fialkoff
    Member
    Posted 1 year ago #

    Excellent! Thanks.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags