• There is a bug in code of the Collapsing Categories plugin. That bug causes a tag cloud to display wrong on all pages except for the main page.

    That error was introduced somewhere between the versions 1.2.1 and 2.0.3 of the plugin.

    I looked into source files of the plugin and found out the code guilty in the problem. So I make up a patch I provide below.

    https://ww.wp.xz.cn/plugins/collapsing-categories/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter les2at

    (@les2at)

    To apply that patch open the file collapsing-categories/collapscatlist.php in some code editor locally and in it’s text:

    1. Find the collapscat_orderbyfilter function and replace it with the following code:

    function collapscat_orderbyfilter($orderby, $args='') {
      global $options;
      extract($options);
      if ($catSort!='') {
    /* les2 commented
        if ($catSort=='catName') {
          $orderby="t.name";
        } elseif ($catSort=='catId') {
          $orderby="t.term_id";
        } elseif ($catSort=='catSlug') {
          $orderby="t.slug";
        } else
    */
        if ($catSort=='catOrder') {
          $orderby="t.term_order";
        }
    /* les2 commented
          elseif ($catSort=='catCount') {
          $orderby="tt.count";
        }
    */
      }
      return $orderby;
    }
    Thread Starter les2at

    (@les2at)

    2. Next, find the get_collapscat_fromdb function and insert between the lines

    if ($showEmptyCat)
        $args['hide_empty'] = false;

    and

    $categories = get_terms($taxonomy, $args);

    the following code:

    /* les2 added */
    
      if ($catSort=='catName') {
        $args['orderby']='name';
      } elseif ($catSort=='catId') {
        $args['orderby']='id';
      } elseif ($catSort=='catSlug') {
        $args['orderby']='slug';
      }
    /* les2: This is still handled in the collapscat_orderbyfilter function for get_terms_orderby filter
        if ($catSort=='catOrder') {
          $orderby="t.term_order";
        }
    */
        elseif ($catSort=='catCount') {
        $args['orderby']='count';
      }
    
    /* end les2 added */

    Of course, it would be well if developer of the Collapsing Categories plugin would merge the code of the pacth in the plugin sources.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘A bug: the plugin mangles a tag cloud display’ is closed to new replies.