• Resolved aprilia

    (@aprilia)


    Actually I want to collapse subPages of a subPage category on my “Pages” list. http://motorcyclebloggers.com is the site. I would like to show only the Tech Talk Articles with subcategories only (such as suspension 101). There will be three parts to suspension 101 and ideally I could collapse those three with the little “+” sign as in windows explorer.

    Is this possible?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hi,

    I was just doing this today !
    So here how I managed it:

    First go to http://www.mattkruse.com/javascript/mktree/source.html and download the files mktree.js, mktree.css, plus.gif, minus.gif and bullet.gif. Create a new directory named mktree under your wp-content/plugins/ directory. Then install the below plugin and you’re done !

    <?php
    /*
    Plugin Name: PagesMenuTree
    Plugin URI:
    Description: This scripts convert <UL> and <LI> tags of the Pages section into a collapsible tree.
    Version: 1.0
    Author: Y. Jeannotat (Danaher Motion SA)
    Author URI: http://www.danaher-motion.ch
    */

    /*
    INSTRUCTIONS:

    No edits to the WordPress source are required.

    Just save the plugin into your WordPress plugins directory, and then
    Activate it on the Plugins tab of the WordPress admin console.
    Read the comments below
    */

    add_filter(‘wp_head’, ‘listCollapse’);

    function listCollapse()
    {
    ?>
    <SCRIPT SRC=”wp-content/plugins/mktree/mktree.js” LANGUAGE=”JavaScript”></SCRIPT>
    <LINK REL=”stylesheet” HREF=”wp-content/plugins/mktree/mktree.css”>
    <SCRIPT LANGUAGE=”JavaScript”>
    //<![CDATA[
    window.onload = function ()
    {
    if (document.getElementById)
    {
    // Find the page section
    var cat = document.getElementById(‘pagenav’);
    if (cat != null)
    {
    // Then get the root of the tree
    var root = cat.getElementsByTagName(‘UL’)[0];
    if (root != null)
    {
    root.className = “mktree”; // Give it the MKTree class
    convertTrees(); // And now transform it into a tree !!!
    }
    }
    }
    }
    //]]>
    </SCRIPT>

    <?php
    }
    ?>

    Thread Starter aprilia

    (@aprilia)

    Thanks for the feedback. I ended up with this error:

    Warning: Cannot modify header information – headers already sent by (output started at /home/motorcyc/public_html/wp-content/plugins/mktree/mktree.php:48) in /home/motorcyc/public_html/wp-admin/admin.php on line 6

    Warning: Cannot modify header information – headers already sent by (output started at /home/motorcyc/public_html/wp-content/plugins/mktree/mktree.php:48) in /home/motorcyc/public_html/wp-admin/admin.php on line 7

    Warning: Cannot modify header information – headers already sent by (output started at /home/motorcyc/public_html/wp-content/plugins/mktree/mktree.php:48) in /home/motorcyc/public_html/wp-admin/admin.php on line 8

    Warning: Cannot modify header information – headers already sent by (output started at /home/motorcyc/public_html/wp-content/plugins/mktree/mktree.php:48) in /home/motorcyc/public_html/wp-admin/admin.php on line 9

    It gave double bullets and no ‘+’ or ‘-‘.

    I am a newb using the Cleanbreeze theme and don’t know much about php. Any thoughts?

    moshu

    (@moshu)

    Thread Starter aprilia

    (@aprilia)

    Thanks moshu!

    kestrel

    (@kestrel)

    Has anyone gotten this working? I’ve got the plugin activated, but it’s not having any effect on my page menu. Is there a step that hasn’t been mentioned here? Perhaps there’s some code to be added to sidebar.php?

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Collapsing Subpages Links’ is closed to new replies.