Wordpress Themes - WP Forum at BFA

Wordpress Themes - WP Forum at BFA (http://forum.bytesforall.com/index.php)
-   Page & Category Menu Bars (http://forum.bytesforall.com/forumdisplay.php?f=10)
-   -   Show empty categories (http://forum.bytesforall.com/showthread.php?t=460)

olsonsp4c Feb 19, 2009 02:24 PM

Show empty categories
 
Hello, this both a tutorial and a feature request to include a little tick box in the Category Bar options that allows you to show empty categories...

Here's how to show empty categories until then :)

In functions/bfa_hor_cats.php

Find this:

Code:

  $list_cat_string = wp_list_categories('orderby=' . $sort_order . '&title_li=&depth=' . $levels . '&exclude=' . trim(str_replace(" ", "", $exclude)) . '&echo=0');
Replace with this:

Code:

  $list_cat_string = wp_list_categories('hide_empty=0&orderby=' . $sort_order . '&title_li=&depth=' . $levels . '&exclude=' . trim(str_replace(" ", "", $exclude)) . '&echo=0');
Scott

paul2008 Apr 20, 2009 09:38 AM

For some reason, it doesn't work for me, though I changed that line.
Any ideas why it may not be working?

Thanks

olsonsp4c Apr 22, 2009 10:41 PM

in 3.3.2, the structure of the statement was changed...

with the addition, it should now be:

Code:

function bfa_hor_cats($sort_order = "ID", $order = "ASC", $levels = "", $titles = "No", $exclude = "") {
        $list_cat_string = wp_list_categories('hide_empty=0&orderby=' . $sort_order . '&order=' . $order . '&title_li=&depth=' . $levels . '&exclude=' . trim(str_replace(" ", "", $exclude)) . '&echo=0');
        $list_cat_string = preg_replace("/<li class=\"(.*?)\n<ul class='children'>/i","<li class=\"rMenu-expand \\1\n <ul class=\"rMenu-ver children\">",$list_cat_string);
        $list_cat_string = preg_replace("/<li class=\"(.*?)\n\t<ul class='children'>/i","<li class=\"rMenu-expand \\1\n\t <ul class=\"rMenu-ver children\">",$list_cat_string);
        $list_cat_string = preg_replace("/<li class=\"(.*?)\n\t\t<ul class='children'>/i","<li class=\"rMenu-expand \\1\n\t\t <ul class=\"rMenu-ver children\">",$list_cat_string);
        $list_cat_string = preg_replace("/<li class=\"(.*?)\n\t\t\t<ul class='children'>/i","<li class=\"rMenu-expand \\1\n\t\t\t <ul class=\"rMenu-ver children\">",$list_cat_string);
        $list_cat_string = preg_replace("/<li class=\"(.*?)\n\t\t\t\t<ul class='children'>/i","<li class=\"rMenu-expand \\1\n\t\t\t\t <ul class=\"rMenu-ver children\">",$list_cat_string);
        $list_cat_string = preg_replace("/<li class=\"(.*?)\n\t\t\t\t\t<ul class='children'>/i","<li class=\"rMenu-expand \\1\n\t\t\t\t\t <ul class=\"rMenu-ver children\">",$list_cat_string);
        $list_cat_string = preg_replace("/<li class=\"(.*?)\n\t\t\t\t\t\t<ul class='children'>/i","<li class=\"rMenu-expand \\1\n\t\t\t\t\t\t <ul class=\"rMenu-ver children\">",$list_cat_string);
        $list_cat_string = preg_replace("/<li class=\"(.*?)\n\t\t\t\t\t\t\t<ul class='children'>/i","<li class=\"rMenu-expand \\1\n\t\t\t\t\t\t\t <ul class=\"rMenu-ver children\">",$list_cat_string);
        $list_cat_string = preg_replace("/<li class=\"(.*?)\n\t\t\t\t\t\t\t\t<ul class='children'>/i","<li class=\"rMenu-expand \\1\n\t\t\t\t\t\t\t\t <ul class=\"rMenu-ver children\">",$list_cat_string);
        $list_cat_string = preg_replace("/<li class=\"(.*?)\n\t\t\t\t\t\t\t\t\t<ul class='children'>/i","<li class=\"rMenu-expand \\1\n\t\t\t\t\t\t\t\t\t <ul class=\"rMenu-ver children\">",$list_cat_string);



All times are GMT -6. The time now is 11:07 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.