Support » How-To and Troubleshooting » [Resolved] Subcategories in Sidebar Widget

[Resolved] Subcategories in Sidebar Widget

  • (Actually, 2.6.1 – but it’s not in the list)

    I’ve got quite a few subcategories, and when I had a non-widgitised side bar, I seem to remember some tweak that would show the sub categories under the parent, rather than alphabetically with the rest.

    However, now that I’ve got a widgitised sidebar, how do I re-do it?

Viewing 4 replies - 1 through 4 (of 4 total)
  • OK. I’ve done a bit more searching & have found

    from reading the third answer, I’m guessing that I have to edit the widget.php file (I can’t right now, as I’ve not got access to the server from this lappy).

    I’ve also had a look at my old sidebar & from memory, it was this line that I had to do something with:
    <?php wp_list_cats('sort_column=name&optioncount=1') ?>

    I’m fairly sure that it was something to do with wp_list_cats … However, though I’ve had a look at some of the templates I’ve not edited, they seem to have been updated since I created this one.

    So, in essence, do I have to edit this line:
    $cat_args = "orderby=name&show_count={$c}&hierarchical={$h}";
    (from that post by Daiv) – what do I change, as it’s got “Hierarchical” in there – which is what I want! … or has he altered what’s in the file?

    Or am I barking in the wrong forest, never mind up the wrong tree?

    <?php wp_list_cats(‘sort_column=name&optioncount=1’) ?>

    OK. Solved it myself. The Widgets.php file may have changed a little since Daiv posted his message (or he was discussing a different bit!)

    However, I found the lines:

    $c = $options[$number]['count'] ? '1' : '0';
    	$h = $options[$number]['hierarchical'] ? '1' : '0';
    	$d = $options[$number]['dropdown'] ? '1' : '0';

    and replaced them with

    $c = $options[$number]['count'] ? '1' : '1';
    	$h = $options[$number]['hierarchical'] ? '1' : '1';
    	$d = $options[$number]['dropdown'] ? '1' : '0';

    Which turned on the hierarchy & also added a count. I’m guessing I’ll have to do this each time I update … as presumably the widget file can get updated.

    Are there plans at any stage to have a sort of “widget customisations” that can be stored in with the theme to add to/ override generic widget settings??

    The thread I meant to refer to in my second post was http://wordpress.org/support/topic/131825?replies=5 – I copied & pasted the wrong one & now I can’t find “Edit”>

    If you go into the Widgets page and hit “Edit” on the Categories widget you can set those options. No need to edit code.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Resolved] Subcategories in Sidebar Widget’ is closed to new replies.