Support » Themes and Templates » changing order of link categories.

  • I can’t find a way to reorder the following example for my sidebar:



    current events



    If I want to reorder the headings (pages, artwork, categories), how do i do that? Is it under the main admin controls for WP, or do I have to edit a file and upload it?

Viewing 7 replies - 1 through 7 (of 7 total)
  • You need to edit your sidebar.php file located in your theme directory.

    Ok, fair enough. But I’m using a free template from someone else. When I open the sidebar.php in that particular theme folder, it doesn’t show the current headings I just added through the WP admin interface (artwork, and links). But those headings *do* display on my site.

    Do I need to manually add them to the sidebar.php in order to reorder them?

    You need to manually change the order in your sidebar.php file. e.g. the code below will display a block of categories. To change the order, you need to move this code to the location where you want it to be.

  • <h2>Categories</h2>
      <?php wp_list_cats(‘sort_column=name&optioncount=1&hierarchical=0’); ?>
  • Heading of the block is enclosed in <h2> tags i.e. <h2>Categories</h2> You can change the heading accordingly.

Most likely you do. If that area is just calls for the links to be shown, WP will go to the default mass listing. Widgets may be the best way to customize this, but you can hand code it.

<?php wp_get_linksbyname(‘Blogroll’); ?>

This is how I display my list, which has the title: Blogroll. I think it is case-sensitive.

Thanks for the replies everyone. I kind of understand what you are all getting at, but I don’t really know what the code means. Would it be too much trouble to look at my sidebar code and put that code where it needs to be? Maybe that will help it sink in for me.

<div class=”rightimage”></div>
<div class=”right”>

<form method=”get” id=”searchform” action=”<?php echo $_SERVER[‘../wp/flowers/simplicity/PHP_SELF’]; ?>”>
<input type=”text” value=”<?php echo wp_specialchars($s, 1); ?>” name=”s” id=”s” size=”23″ />
<input type=”submit” id=”searchsubmit” value=”search” />

<div class=”sideheading”>about</div>
<p style=”padding-left: 10px; padding-right: 10px;”><?php bloginfo(‘description’); ?>

<?php if (function_exists(‘wp_theme_switcher’)) { ?>
<div class=”sideheading”>themes</div>
<?php wp_theme_switcher(); ?>
<?php } ?>

<div class=”sideheading”>pages</div>

    <?php wp_list_pages(‘title_li= ‘); ?>

<div class=”sideheading”>categories</div>

    <?php wp_list_cats(); ?>

<div class=”sideheading”>archive</div>

    <?php wp_get_archives(‘type=monthly’); ?>

$link_cats = $wpdb->get_results(“SELECT cat_id, cat_name FROM $wpdb->linkcategories”);
foreach ($link_cats as $link_cat) {
<div id=”linkcat-<?php echo $link_cat->cat_id; ?>” class=”sideheading”><?php echo $link_cat->cat_name; ?></div>

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

<?php } ?>

<div class=”sideheading”>et cetera</div>


My site is And remember I just want to reorder the sidebar headings. Preferbly to have ‘artwork’ and ‘links’ above ‘pages’. Sorry for all the bother. It’s just really frustrating for an artist trying to understand code. I’m trying to get better though.

check out the codex on this – it helps more than posting the same question in the forums 4 times…

This may be totally beside the point…

Am I right that you want to change the order of your link categories?

The easiest way to do that is to add spaces in front of the names of your categories. For instance 5 spaces before the one you want on the top, 4 for the one you want in second place,…

The pages will always appear above your links, unless you move the code.

Normally the code will appear like this:
<?php wp_list_pages(‘title_li=<h2>Pages</h2>’ ); ?>

  • <h2>Archives</h2>
      <?php wp_get_archives(‘type=monthly’); ?>
  • <h2>Categories</h2>
      <?php wp_list_cats(‘sort_column=name&optioncount=1&hierarchical=0’); ?>
  • <?php /* If this is the frontpage */ if ( is_home() || is_page() ) { ?>
    <?php get_links_list(); ?>

    All you have to do is move the first line (<?php wp_list_pages(‘title_li=<h2>Pages</h2>’ ); ?>) to the bottom.

    I fixed the pages problem by removing that line of code all together. I create pages and then add a link to them in one of my categories. (manage pages -> right click on view and copy link location and you have your url)

    Viewing 7 replies - 1 through 7 (of 7 total)
    • The topic ‘changing order of link categories.’ is closed to new replies.