WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Sidebar Alphebetized AND I DON'T WANT IT TO BE (14 posts)

  1. firehead
    Member
    Posted 8 years ago #

    Ok ok I know there are tons of similar threads to this, but I searched around and I can't find anyone who DOESN'T want their link categories alphebetized.

    I'm not talking about Archives, Categories, Meta, or any of that. I'm talking about link categories I create. The default is "Links".

    On my page (www.the-firehead.com) I've created a few different ones, and I'd to be able to put the categories in whatever order.

    I don't want to sort them by name, or by ID.

    So INSTEAD of the order they are in now:

    Coolness Personified
    Music worth listening to ...
    Places worth going to ...
    I am all over the place ...
    Stuff worth looking at ...
    Brothers
    Sisters

    I want them to be:

    Sisters
    Brothers
    Coolness Personified
    I'm all over the place ...
    Places worth going to ...
    Music worth listening to ...
    Stuff worth looking at ...

    What do I do?

    SEAN

  2. Either code the list manually, or re-do the links so that their IDs are in the order that you want.

  3. vkaryl
    Member
    Posted 8 years ago #

    I'm pretty sure there's some info on this in the codex.... http://codex.wordpress.org/Main_Page, search on links, listing

  4. firehead
    Member
    Posted 8 years ago #

    "Either code the list manually, or re-do the links so that their IDs are in the order that you want."

    What happens when I want a new category in a couple months? Or I decide the way I have it organized now is stupid and I want to change it? (likely!)

    Don't get me wrong, WordPress is great, but I should be able to change the ID when I want to!!

    Well I know that the "get_links_list()" function is grabbing the links from somewhere ... where is it grabbing them from? Maybe I can get to that list and change the ID's manually?

    SEAN

  5. vkaryl
    Member
    Posted 8 years ago #

    Probably.... check the codex as I posted above.

  6. firehead
    Member
    Posted 8 years ago #

    I did. None of the search topics that came up have to do with what I need.

  7. vkaryl
    Member
    Posted 8 years ago #

    Hmm. Well, some of the coding gurus around might eventually be able to help you with a specific if/else statement then.... but I can't. I don't do code, sorry.

  8. thegreatnorth
    Member
    Posted 8 years ago #

    You could edit your sidebar.php to list the link categories in the order your want by making multiple request for get_links

    <?php get_links('1', '<li>', '</li>', '', 0, 'name', 0, 0, -1, 0); ?>
    <?php get_links('2', '<li>', '</li>', '', 0, 'name', 0, 0, -1, 0); ?>
    <?php get_links('3', '<li>', '</li>', '', 0, 'name', 0, 0, -1, 0); ?>

    The number that is different is the category id, this will allow you to display them in the order you want.
    Not a great solution but it should work...

  9. cluelessone
    Member
    Posted 8 years ago #

    My way of doing this was to alter the settings for the link category so that links were listed by rating, then rate the links in the order I wanted them listed.

  10. firehead
    Member
    Posted 8 years ago #

    "You could edit your sidebar.php to list the link categories in the order your want by making multiple request for get_links"

    ok that worked for the links, but there are no category titles any idea how to get those?... sorry I'm formerly a programming major, but I've been out of the loop for a couple years ... I don't know PHP that well!!

    SEAN

  11. thegreatnorth
    Member
    Posted 8 years ago #

    Sorry Sean, I didn't explain it all.
    This is what you would require in your sidebar to achieve what you are looking for:
    <li>
    <h2><?php _e('Sisters'); ?></h2>
    <ul>
    <?php get_links('1', '<li>', '</li>', '', 0, 'updated', 0, 0, -1, 0); ?>
    </ul>
    </li>

    You will have to copy and paste this code over and over again for each category that you want displayed. Change the word "Sisters" to the proper category name for each and the number "1" for each link category ID. The word "updated" means that the links under that heading (example: Sisters) will be sorted by when they were last updated.

    you can find more info for what each item between single quotes means here: http://codex.wordpress.org/Template_Tags/get_links

    Jeff

  12. firehead
    Member
    Posted 8 years ago #

    sweet thanks!

    one more question while I'm at it though, instead of "updated" or "name" can I put in "random" and have it sort them randomly?

    and check my blog, I replied to your comment about the song.

    SEAN

  13. thegreatnorth
    Member
    Posted 8 years ago #

    Yep, just use rand

    you can also sort by:

    id, url, name, target, category, description, owner, rating, updated, rel, notes, rss and length - The length of the link name, shortest to longest.

  14. firehead
    Member
    Posted 8 years ago #

    thanks again

    you are the wind beneath my wings

    SEAN

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.