• I’m trying to use category_orderby and orderby parameters for wp_list_bookmarks in my sidebar, but it doesn’t respond when I change it.

    Here’s the relevant code from the sidebar.php file:

    <?php wp_list_bookmarks('category_orderby=slug&orderby=slug'); ?>

    I put a letter (a,b,c,d) in the front of each slug to sort properly. The list still sorts by name.

    Here’s the link for the blog: https://wsm.wsu.edu/discovery

    Any ideas why it’s not sorting properly?

Viewing 4 replies - 1 through 4 (of 4 total)
  • This sorts links in category slug order ascending. Within each category it sorts by link description order descending.

    <?php wp_list_bookmarks('category_orderby=slug&category_order=ASC&orderby=description&order=DESC'); ?>

    Note: there is no orderby=slug for the links. Slug is only applicable to the link category.

    See the template tag, wp_list_bookmarks().

    trixienolix

    (@trixienolix)

    I am having a similar problem.

    I have 2 link categories: headeronly, headerandfooter
    These have the following slugs respectively: 01headeronly, 02headerandfooter

    I want links in the headeronly category to appear before my headerandfooter category, and within these I want the links to display in order of id.

    I can’t get the category_orderby command to make any changes. Here’s the code:

    <?php wp_list_bookmarks('title_li=&categorize=0&category=9,10&category_orderby=slug&category_order=ASC&orderby=id' ); ?>

    What am I doing wrong?

    t31os

    (@t31os)

    This works for me…

    <?php wp_list_bookmarks('title_li=&categorize=0&category_orderby=slug&orderby=id&category=16,15'); ?>

    You don’t need to set cat order with asc, ascending is default…

    Code works on a test install…

    Obviously the IDs are different for me, but that shouldn’t make a difference..

    Hmm, I was not able to get the links to sort by category by changing either links.php or sidebar.php, where the wp_list_bookmarks function is invoked. I had to hard code the default sort in the /wp-includes/bookmark-template.php file where the function is located and defaults are set. I set the default for category order on line 206 by changing the value ‘name’ to ‘slug’. Dunno why the function was not accepting the category_orderby=slug&category_order=ASC arguments I put in the template files, but it works. Just annoying that one would have to hard code the core WP function to get the link categories to sort. Silly…

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘wp_list_bookmarks won’t sort properly’ is closed to new replies.