Support » Fixing WordPress » category section in sidebar

  • Hello. I’m new to wordpress and my knowledge of CSS is rudimentary at best. My biggest problem right now is that I accidentally deleted a posting category in my admin panel. Its the section which is supposed to show up in the sidebar and display how many posts in each category have been posted so far.
    Apart from that, I have a really hard time finding out how to sort my link categories in the sidebar, without doing any major changes to the php. You can take a look at my site here:
    Any help is greatly appreciated…

Viewing 15 replies - 1 through 15 (of 15 total)
  • Well if you deleted a post Category then you could add that Category back and then edit each post and assign the post to that new Category.

    There is a message on your admin panel about deleting Categories that says:

    Note: Deleting a category does not delete posts from that category, it will just set them back to the default category.

    As for your Link Categories–you can specify the order of links within each Category. See Link_Categories_SubPanel.

    Thanks for the quick reply but this doesn’t really answer my question.
    I deleted the section which automatically showed the category titles, and the number of posts posted under each category title. To clarify, you can see it under “flokkur” on this guys site. Its in icelandic and the only reference I have right now:

    Then it seems you deleted code in your sidebar.php file. Can you restore that file or retrieve that file from the original Theme you used for your site?

    Here’s a sample set of code used in the WordPress Theme Default sidebar.php file. This is after the archives section.

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

    That worked perfectly, thanks a bunch.

    Now I only have to figure out how to change the order of the categories in the sidebar. (not the order of the links themselves)

    Are talking about the post Categories or Link Categories?
    (either way, the Codex is a great resource for basic questions… Template_Tags)

    As I mentioned, my css skills are practically non existent (yet). So I didn’t find anything helpful there. I’m talking about every single category that shows up in the sidebar (not the links, mind). I’d like to rearrange the categories in the order I want them to be in, and not as its now, which is: (Categories) (Hello) (Click)…etc.

    I didn’t ask you about your css skills 🙂
    But I am going to ask you to use the proper words for what you want to describe…
    Categories is a very specific WP term, and it refers to the post categories –> they are displayed under the “Categories” header in your sidebar.
    The rest are NOT categories.
    If you want to change anything in your sidebar, you’ll have to open it in a plain text editor and move around the items

    Sorry for being imprecise with my terminology, but I’m talking about sorting the link sections. Have (About) first, (Read) second etc.
    It seems to me that “moving around items in a text editor” isn’t going to do the job, since I don’t know which items to move around in the first place.
    I think this should be an easily accessible option in the admin-panel…

    It is not (in the admin panel).
    It is simple HTML… and a little bit of familiarity with the template tags. Usually all the links and listings are generated by the template tags placed in the sidebar.php.

    I’ve looked through the sidebar.php file and couldn’t find anything related to the sorting of my link categories. A precise solution to this would be much appreciated.

    I tried that method already before I posted here and it doesn’t change the order. Somehow the sorting still depends on the link category ID. I’m seriously starting to doubt the user friendliness of wordpress, since such a basic function should simply be included in the admin control panel.

    On my test blog I have Link Categories Blogroll and Assistance where the Link Category IDs are 1 and 2 respectively, but they display first with Assistance followed by Blogroll.

    This behavior in my sidebar.php file is controlled by this code: <?php get_links_list(); ?>

    If you haven’t given up on WordPress maybe post your sidebar.php file at

    You can also make enhancement recommendations at:
    Codex doc Version_1.6

    Good luck.

    Ok, I believe the problem lies somewhere in here: (from my sidebar.php)

    <?php } ?>

  • <h2>Categories</h2>
      <?php wp_list_cats(‘sort_column=name&optioncount=1&hierarchical=0’); ?>
  • <?php $link_cats = $wpdb->get_results(“SELECT cat_id, cat_name FROM $wpdb->linkcategories”);
    foreach ($link_cats as $link_cat) { ?>
    <li id=”linkcat-<?php echo $link_cat->cat_id; ?>”><h2><?php echo $link_cat->cat_name; ?></h2>

      <?php wp_get_links($link_cat->cat_id); ?>

    <?php } ?>

Seems like you could replace:

<?php $link_cats = $wpdb->get_results("SELECT cat_id, cat_name FROM $wpdb->linkcategories");
foreach ($link_cats as $link_cat) { ?>
<li id="linkcat-<?php echo $link_cat->cat_id; ?>"><h2><?php echo $link_cat->cat_name; ?></h2>
<?php wp_get_links($link_cat->cat_id); ?>
<?php } ?>

with just

<?php wp_get_links(); ?>

Please make sure you have a backup copy of your sidebar.php before you make changes just in case…

Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘category section in sidebar’ is closed to new replies.