WordPress.org

Ready to get started?Download WordPress

Forums

Displaying Links with Catagories (3 posts)

  1. JimmyDeemo
    Member
    Posted 6 years ago #

    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?

  2. aslee
    Member
    Posted 6 years ago #

    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.

  3. JimmyDeemo
    Member
    Posted 6 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic