The MU forums have moved to WordPress.org

How can I change the order at which blogs are displayed? (8 posts)

  1. 24dashmb
    Member
    Posted 15 years ago #

    Hi,

    On our blog homepage we have 10 blogs (e.g blog 1 is Joe Blogs, blog 2 is Jim Smith's etc), What i'd like to know is can I re-order how these are shown on the homepage? e.g Jim is first and Joe is second etc etc?

    I would be grateful for any help.

    Regards.

  2. drmike
    Member
    Posted 15 years ago #

    Um, how are you displaying them in the first place? Are you using a function to do it?

  3. 24dashmb
    Member
    Posted 15 years ago #

    Hi,

    They are being returned by the home.php file, I'm not sure which function specifically does it, its just the standard way I think.

    Apologies for my newbieness :)

  4. 24dashmb
    Member
    Posted 15 years ago #

    Also if you know of a better way to set-up what i'm trying to achieve, I would be most grateful of any pointers.

  5. drmike
    Member
    Posted 15 years ago #

    Do you mean the home.php file that comes with the standard WPMu theme?

  6. pixline
    Member
    Posted 15 years ago #

    normally, you'll get the blog's list with $blogs = get_last_updated(); or something like it, and it will return an array. in 99% of cases, simply invert with $blogs = array_reverse($blogs); or tweak the array in some way.

    Otherwise, you can make an hardcoded array with the order like this:


    $my_order = array("blog1id"=>"ordernum","blog2id"=>"ordernum", [...] "blogNid" => "ordernum");

    and use PHP array functions to make your order parsing the $blogs array cited above.

    Hope it will help to understand :-)

  7. 24dashmb
    Member
    Posted 15 years ago #

    Hi,

    drmike yeah it is the home.php file that comes with the standard theme.

    pixline cheers for your input will give it a go.

    Thanks to both of you :)

  8. pixline
    Member
    Posted 15 years ago #

    I forget: there's three ways to get blog list, as far I can remember:


    $blogs = get_blog_list();
    $blogs = get_most_active_blogs(5);
    $blogs = get_last_updated();

    To get the blog list ordered by id ascending, my upcoming plugin use:


    $blogs = array_reverse($blogs);

    You need the order array only for custom ordering.

About this Topic

  • Started 15 years ago by 24dashmb
  • Latest reply from pixline