• 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: https://www.webspaceworks.com/resources/cat/wp-plugins/31/, and https://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! ??

Viewing 10 replies - 1 through 10 (of 10 total)
  • 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.

    Thread Starter paulritter

    (@paulritter)

    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: https://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

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

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

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

    Thread Starter paulritter

    (@paulritter)

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

    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="https://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.

    Thread Starter paulritter

    (@paulritter)

    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.

    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?

    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

    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.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Expandable/collapsable categories?’ is closed to new replies.