WordPress.org

Forums

category section in sidebar (16 posts)

  1. dcr
    Member
    Posted 9 years ago #

    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: http://www.danielclausreuter.com/blog
    Any help is greatly appreciated...

  2. MichaelH
    Member
    Posted 9 years ago #

    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.

  3. dcr
    Member
    Posted 9 years ago #

    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: http://www.onrushdesign.com/blog/

  4. MichaelH
    Member
    Posted 9 years ago #

    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.


    <li><h2>Categories</h2>
    <ul>
    <?php wp_list_cats('sort_column=name&optioncount=1&hierarchical=0'); ?>
    </ul>
    </li>

  5. dcr
    Member
    Posted 9 years ago #

    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)

  6. moshu
    Member
    Posted 9 years ago #

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

  7. dcr
    Member
    Posted 9 years ago #

    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.

  8. moshu
    Member
    Posted 9 years ago #

    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

  9. dcr
    Member
    Posted 9 years ago #

    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...

  10. moshu
    Member
    Posted 9 years ago #

    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.

  11. dcr
    Member
    Posted 9 years ago #

    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.

  12. MichaelH
    Member
    Posted 9 years ago #

  13. dcr
    Member
    Posted 9 years ago #

    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.

  14. MichaelH
    Member
    Posted 9 years ago #

    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 http://pastebin.com/

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

    Good luck.

  15. dcr
    Member
    Posted 9 years ago #

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

    <?php } ?>

  16. <h2>Categories</h2>
      <?php wp_list_cats('sort_column=name&optioncount=1&hierarchical=0'); ?>
  17. <?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 } ?>

  • MichaelH
    Member
    Posted 9 years ago #

    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...

  • Topic Closed

    This topic has been closed to new replies.

    About this Topic

    Tags