WordPress.org

Ready to get started?Download WordPress

Forums

Fold Category List for 2.3.1 (15 posts)

  1. codesmithsf
    Member
    Posted 6 years ago #

    Greetings WP Community,

    I recently upgraded a site from 2.0 to 2.3.1. They use Web Space Works excellent Fold Category List plugin. Unfortunately it doesn't look a 2.3.1 version exists yet so I made the necessary changes to get it to work. It's numbered as version 1.2 (unofficially). Hope this is useful for folks. It should work for 2.3 as well. It's not been extensively tested - any comments or problems welcome.

    You can download it here:
    Fold Category Lists for 2.3.1

    This work was done under contract for Splunk in San Francisco.

    Thanks,
    Justin Fraser
    Web Developer
    digipop

  2. mishko
    Member
    Posted 6 years ago #

    Justin, that absolutely rules. Trying to get child categories to display sensibly in 2.3.1 was seeming quite impossible until I discovered your modded plug-in. (How I miss the 'children' argument from the now-depreciated wp_list_cats function!)

    Now child categories are hidden unless visiting a parent category. This cleans up my sidebar and makes for more intelligent browsing through 30+ categories.

    THANK YOU!

  3. stitchlips
    Member
    Posted 6 years ago #

    How exactly do you get this plugin to work?
    I replaced the wp_list in my sidebar and I see no changes.

  4. codesmithsf
    Member
    Posted 6 years ago #

    Once you've installed and activated the plugin you'll need to modify sidebar.php to call the main function. I'm not sure what all the options are (check the WebSpaceWorks site for more details) but here's the snippet from my sidebar.php file:

    <?php
    //standard 2.3.1 category call...
    //wp_list_categories("show_count=1&title_li=");
    
    //...replaced with the Fold Category List function call
    wswwpx_fold_category_list ("hide_empty=1&optioncount=1");
    ?>

    The sidebar.php file is located at wp_content/themes/default/sidebar.php

  5. mystifier
    Member
    Posted 6 years ago #

    Terrific Justin, many thanks.

    One very small change:
    $exclusions .= ' AND term_ID <> ' . intval($excat) . ' ';

    needs to be amended to:
    $exclusions .= ' AND t.term_ID <> ' . intval($excat) . ' ';

    to make this parameter work.

  6. deeplook
    Member
    Posted 6 years ago #

    Hello,

    I am curious how you got this plug-in to work.

    when i try it, it only gives back 'no categories'. Could it be template related?

    The wp-list function of my template says:

    <?php wp_list_cats('sort_column=name&optioncount=1&hierarchical=0'); ?>

    and i changed this too:

    from:

    $exclusions .= ' AND term_ID <> ' . intval($excat) . ' ';

    into

    $exclusions .= ' AND t.term_ID <> ' . intval($excat) . ' ';

    Any help is very much appreciated. :-(
    Thanks, Toto

  7. codesmithsf
    Member
    Posted 6 years ago #

    @mystifier - Thanks for the fix. I've included it in the plugin as version 1.2.1 and updated the download link above. So you now can you use &exclude= followed by a comma delimited list of category ids to exclude certain categories from showing up.

    Example:
    wswwpx_fold_category_list ("hide_empty=1&optioncount=1&exclude=2,3");

    @deeplook - Have you updated your sidebar.php to include the call to wswwpx_fold_category_list?

  8. deeplook
    Member
    Posted 6 years ago #

    Hi codesmithsf,

    yes i think so. I don't have any clue about this php stuff but the programmer did it all for me. But all i was able to see on the nav bar was "No Cotagories".

    He said that it could be due to my table prefix cause i don't use the standart wp_ one.

  9. mhr
    Member
    Posted 6 years ago #

    Thanks for revving this plugin, codesmithsf! I wish WP had built-in category folding, but since it doesn't this is the best I've found, and I'd be very sad if it broke! (To be fair, WP is missing so little that I want that it's really not much hardship to have to figure out the little bits that aren't there in the default install, so I can't really complain.)

    I ended up commenting out the following line in my copy:

    $sort_column = 'term_'.$sort_column;

    ...so that I could continue my long-time call to this plugin's function:

    wswwpx_fold_category_list('sort_column=name&optioncount=0&hide_empty=0&children=1&hierarchical=1');

    ...since without doing so it tries to sort on term_name, which is a nonexistent column.

    I guess I'd have to use sort_column=term_id rather than sort_column=id if I wanted to sort by ID, but since I don't, I can live with that. :-)

  10. stitchlips
    Member
    Posted 6 years ago #

    Ok I figured out the problem with my site and getting it to work. If you are using widgets and you want this plugin to work, you need to edit the widgets.php file located in the wp-includes folder. I had to change line 647 from
    <?php wp_list_categories($cat_args . '&title_li='); ?>
    to
    <?php wswwpx_fold_category_list($cat_args . '&title_li='); ?>

    and now it works great!

  11. xue
    Member
    Posted 6 years ago #

    Hello,

    I'm a newbie here & want to use category as described above.
    I've located the category call in sidebar.php & changed it to wswwpx_fold_category_list call

    However, I can't locate the $exclusion parameter.
    Am I looking at the wrong place?

    I use widgets & my site is at http://www.click2ediscovery.com
    thanks,
    xue

  12. roblgs
    Member
    Posted 6 years ago #

    Hi,

    For anyone looking I have now rolled Justin's mods into an 'official' release of Fold Page List, and extended beyond them to support some of the new arguments and default sort that are in the latest versions of WP.

    This new version remains compatible with previous WP versions of WP as well, so no need to maintain two different versions of the plugin.

    Get the new version from the Fold Category List Support page.

    Cheers

    Rob

  13. xue
    Member
    Posted 6 years ago #

    Hello Rob,

    Thanks for your reply.

    I installed the plugins but had to deactivate it as the 'category' selection didn't display the selected category.

    I use wordpress and sandbox. http://www.click2ediscovery.com

    Thanks,
    xue

  14. roblgs
    Member
    Posted 6 years ago #

    Xue,

    Can you be more specific... how are you calling the plugin?

    I have tested it here on 2.3.1 and all is working as expected.

    Need more info.

    You can contact me via the email in the header of the plugin.

    Regards

    Rob

  15. xue
    Member
    Posted 6 years ago #

    Hello Rob,

    I've posted a reply to your email as suggested by you.
    Thanks
    Xue

Topic Closed

This topic has been closed to new replies.

About this Topic