Support » Themes and Templates » Displaying Links with Catagories

  • I’m currently using the Rin 1.1 theme. At the moment it lists my links in the side bar in one big list, like this;

    Links
    LinkFromCat1
    LinkFromCat1
    LinkFromCat2

    What i want to do is show the catagories and then the links underneath them, like this;

    Links
    Cat1
    LinkFromCat1
    LinkFromCat1
    Cat2
    LinkFromCat2

    I’ve tried finding an appropriate function to place in the sidebar.php, but i haven’t had any look. Right now the links part lucks like;

    <li><h2><?php _e('Links'); ?></h2>
       <ul>
        <?php get_links('-1', '<li>', '</li>', ''); ?>
       </ul>
      </li>

    Can anyone help please?

Viewing 2 replies - 1 through 2 (of 2 total)
  • If I remember right, get_links() is deprecated since Version 2.1, so let’s use wp_list_bookmarks() instead.

    Try this:
    <?php wp_list_bookmarks('categorize=1&before=<li>&after=</li>&show_images=0&show_description=0&orderby=name'); ?>

    I think it does everything you’re looking for in that code. Take a look at the wp_list_bookmarks Codex page if you need further customization.

    That works like a charm, thanks a lot. Just out of interest, do you think its a good idea to go through and make sure i’m using up to date function calls? I’m sure i’m using other depreceated code. If so whats the best way to identify the up to date functions as i obviously had trouble with this one?

    Thanks again for the help.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Displaying Links with Catagories’ is closed to new replies.