WordPress.org

Ready to get started?Download WordPress

Forums

Wierd random order of links (20 posts)

  1. hiawatha
    Member
    Posted 9 years ago #

    The theme I am using has this code. In the html it
    results in links in a random order. I can reload the
    page and get different non-predicable results each tim.

    <ul class="menu_ul">
    <?php wp_get_links($link_cat->cat_id); ?>

    1. What's going on here ?
    2. How can I make the order constant. I tried
    wp_get_linksbyname('') but
    same result. In the management this link category
    is set to sort by name.

    Thanks

    Hiawatha (andy).

  2. hiawatha
    Member
    Posted 9 years ago #

    I should add, I put the actual category name as param to wp_get_linksbyname - its been chopped from the post above because I used non-escaped lt and gt in.

    andy

  3. skippy
    Member
    Posted 9 years ago #

    wp_get_links() should obey the options you specify in the Links Manager. You could try get_links() instead, to see if you can force it to display as you want.

  4. hiawatha
    Member
    Posted 9 years ago #

    i will try that, but its still wierd. How can the result be in different orders at random ? I want a fix yes but I also want to understand whats happening here.

    I know we use load of things that have no need to be ordered, they just are anyway but Ive not seen this before. Is it maybe some hashing algorithm in mysql that operates on a seed and gives possibly different results each time and makes the records come out in a different order ?

    99% of the progs ive ever been involved with operate sequentially (and deterministically) at least within what we think of as one piece of code or one process - but here the html that emerges is different each time.

    Please enlighten me as to how this can be.

    hiawatha (andy)

  5. Mark (podz)
    Support Maven
    Posted 9 years ago #

    If it is random, it's because you have that option set in Link categories.

    The tags Skippy indicates seem to be what you need.

  6. hiawatha
    Member
    Posted 9 years ago #

    nope - its set to name order.

    using 1.5.1.2.

    I can't in any case see how I would set it to "random".
    The drop-down box has settings like link-id, name, etc. but not one for random.

    hiawatha(andy)

  7. Mark (podz)
    Support Maven
    Posted 9 years ago #

    Link to your site ?
    Paste your sidebar code here: http://phpfi.com/

  8. hiawatha
    Member
    Posted 9 years ago #

    http://axelrod.plus.com/wordpress/

    code posted on that address (the relevant piece, not all the
    sidebar)

    hiawatha

  9. hiawatha
    Member
    Posted 9 years ago #

    o h forgot - the two links under the heading"Places" change their order at random.

    hiawatha

  10. Mark (podz)
    Support Maven
    Posted 9 years ago #

    I can't see the code ?

  11. hiawatha
    Member
    Posted 9 years ago #

    i put it on that URL you posted

    and I just did so again

    H(A)

  12. hiawatha
    Member
    Posted 9 years ago #

    still wierd. any ideas anyone?

    Hiawatha(andy)

  13. Mark (podz)
    Support Maven
    Posted 9 years ago #

    http://axelrod.plus.com/wordpress/
    That shows the result, not the code that makes the result.

    Can you post your sidebar code at the phpfi link ?

  14. hiawatha
    Member
    Posted 9 years ago #

    i posted it there several times already, i dont understand why its not visible

  15. Mark (podz)
    Support Maven
    Posted 9 years ago #

    Because it's php - use the other link.

  16. hiawatha
    Member
    Posted 9 years ago #

    posted again - its on
    http://phpfi.com/68667

    H(A)

  17. Mark (podz)
    Support Maven
    Posted 9 years ago #

    Code is fine.

    Please post this screenshot from your options :
    http://www.tamba2.org.uk/links.png

  18. hiawatha
    Member
    Posted 9 years ago #

    I put two pics of this in here

    http://axelrod.plus.com/sftp/wpdebug/

    H(A)

  19. hiawatha
    Member
    Posted 9 years ago #

    i spotted it
    thanks

    andy

  20. hiawatha
    Member
    Posted 9 years ago #

    should be resolved now, thankyou.
    Years ago I used to be a proponent of egoless programming (Weinberg) - sometimes ones own errors are hard to spot.

    Ty Podz.

    andy

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags