WordPress.org

Forums

Problem with orderby in wp_list_bookmarks() (6 posts)

  1. FlossieT
    Member
    Posted 5 years ago #

    I'm probably making a basic error in syntax here, but I've tried various combinations of single and double quotes and can't get this to work.

    According to the List Bookmarks reference, the 'orderby' parameter should accept multiple values as a comma-separated list.

    I'm trying to use this template tag to create a 'blogroll' page, as the sidebar version is getting too long.

    I've created my page template, and entered the function as follows:

    <?php wp_list_bookmarks('categorize=0&category_name=Links&title_li=0&orderby=rating,name'); ?>

    intending to get a list that's sorted initially by rating, and then within groups of links with the same rating, by name.

    No dice. When I use it in this format, I just get a blank space under the page title (everything else displays fine). If I take out the 'name' portion, it displays, but appears to be displaying links with the same rating in order of the date they were added to the database.

    Have I misunderstood what I need to do here?

    Thanks,

    Rachael

  2. vtxyzzy
    Member
    Posted 5 years ago #

    I can't be sure, but this looks like it may be a bug. Code your orderby like this and see if it works: orderby=rating,link_name.

  3. FlossieT
    Member
    Posted 5 years ago #

    Yes - that works fine. Is it a blooper in the codex documentation then?

  4. vtxyzzy
    Member
    Posted 5 years ago #

    Nope, it is a bug. I created a ticket and it has been assigned to get a patch.


  5. Member
    Posted 5 years ago #

    I think if you use the actual database field names, it will work; the documentation says do this:

    orderby=rating,id

    It doesn't work, but this does:

    orderby=rating,link_id

    The database field names are (in version 2.9.2) are:
    link_id
    link_url
    link_name
    link_image
    link_target
    link_description
    link_visible
    link_owner
    link_rating
    link_updated
    link_rel
    link_notes
    link_rss

  6. vtxyzzy
    Member
    Posted 5 years ago #

    Yes, but notice that you use 'rating', not 'link_rating' as in the documentation. That is because the function prepends 'link_' to the front of the string instead of before each of the comma-separated values. This qualifies it as a bug.

Topic Closed

This topic has been closed to new replies.

About this Topic