WordPress.org

Ready to get started?Download WordPress

Forums

Expandable/collapsable categories? (11 posts)

  1. PaulRitter
    Member
    Posted 8 years ago #

    Hi, I've searched far and wide for a code to do this, and I've found some, but couldn't figure out how to use them.

    What I'm looking for is to be able to set certain categories of mine to be automatically collapsed when someone views my site, but with a "+" button beside them to expand them if they so wish. I want to clarify that I want to be able to specify which categories I want to automatically be collapsed, I don't want all of them to do it.

    I found these: http://www.webspaceworks.com/resources/cat/wp-plugins/31/, and http://www.webspaceworks.com/resources/cat/wp-plugins/30/ but I couldn't figure out how to work either one; in the instructions they provided to do, no such code existed in my sidebar.php file that they said to replace.

    Please help? Thanks! :)

  2. Ajay
    Member
    Posted 8 years ago #

    wp_list_cats lists the categories in your sidebar.

    If you don't have that in your sidebar you don't need to worry.

    Just add <?php wswwpx_fold_category_list(); ?> as the plugin page says to display the categories.

  3. PaulRitter
    Member
    Posted 8 years ago #

    Hi, thanks for replying. Umm, I guess I shouldn't have used categories as the word.

    I've got literally a ton of links and stuff in my sidebar. So many, in fact, that it lengthens the page past the articles I have written. You can see it at: http://www.paulritter.co.nr. I'm using another plugin called post-tease or something, and it basically shortens every entry and gives people the option of reading the entire thing or not. But now that I use this, all my links drag the length of my page waaaay down. I want to be able to have those "link categories" be automatically collapsed, not the actual categories list.

    Is there a way? Thanks

  4. Mark (podz)
    Support Maven
    Posted 8 years ago #

    I use one way:
    http://www.tamba2.org.uk/T2/
    check the archives and category links.

    The method is described here:
    http://www.tamba2.org.uk/wordpress/collapse/

    It's not perfect but it might be a pointer to the answer ?

  5. PaulRitter
    Member
    Posted 8 years ago #

    Aha, yes, that's exactly what I want, as long as I can make it collapse other things on the sidebar, not just Archives and Categories.

    And I'm kind of confused about how to work that code...can you explain it to me how I install all those bits and where? Thanks!!!

  6. Edd
    Member
    Posted 8 years ago #

    Ok so if you look at the second link podz posted you'll see a guide to achieve this.
    So the first thing you want to do is get your FTP client open and create a new folder called "hacks". Create it under the wp-content folder.
    Once you've done this, you want to open up notepad and paste this code into it:
    function kadabra(zap) {
    if (document.getElementById) {
    var abra = document.getElementById(zap).style;
    if (abra.display == "block") {
    abra.display = "none";
    } else {
    abra.display = "block"
    }
    return false
    } else {
    return true
    } }

    Under file type, select "all files" and name it "kadabra.js" save it somewhere memorable and close notepad.

    Return to your FTP client and upload the file you just created to the folder you just created (wp-content/hacks)

    Now you want to navigate to /wp-content/themename/ and open up header.php for editing.
    In header.php you want to add this code:
    <script type="text/javascript" src="http://www.paulritter.co.nr/wp-content/hacks/kadabra.js">
    </script>

    Imbetween the "<head>" and "</head>" tags.
    Save your changes and close header.php.
    Now open up "style.css" and add
    #m1, #m2, #m3, #m4 {
    display: none;
    }

    to the bottom of the style.

    Now you said you wanted to collapse the links section, this is where I need someone else to fill in the last bit. See, the links header isn't coded in the same way as "Categories" (at least not for me). I'll have a look myself and post back but if anyone knows themselves, please post here to finish off my quick guide.

    Hope that helps, post back with any problems.

  7. PaulRitter
    Member
    Posted 8 years ago #

    Still won't work.

    Oh well, don't bother. I'm cleaning up my site anyways, there was way to much stuff on it. Thanks anyways.

  8. chickspirit
    Member
    Posted 7 years ago #

    Hi ~

    Edd said:

    "Now you said you wanted to collapse the links section, this is where I need someone else to fill in the last bit. See, the links header isn't coded in the same way as "Categories" (at least not for me). I'll have a look myself and post back but if anyone knows themselves, please post here to finish off my quick guide."

    Does anyone have the answer as to how to apply the javascript from tamba2.org.uk/T2/ to the links section?

  9. naifyboy
    Member
    Posted 7 years ago #

    i have also tried the code in
    tamba2.org.uk/wordpress/collapse/

    doesnt change a thing for me.

    have treble checked my code and the paths to the script etc...still no good...there must be loads of us who want to do this..

    anyone have any ideas?

    thanks

  10. Rok
    Member
    Posted 7 years ago #

    I am using tamba2.org.uk/T2/ script from the days of WordPress 2.0 till date. And I have no problems. It is very flexible and customizable.

  11. silpstream
    Member
    Posted 7 years ago #

Topic Closed

This topic has been closed to new replies.

About this Topic