The MU forums have moved to WordPress.org

Query Blogs and domain name (9 posts)

  1. redsoxmaniac
    Member
    Posted 14 years ago #

    I want to have a drop-down list for all my blogs in Wordpress MU.

    I want it to search for the blogs, and have the link with the blog using the text from the blog description.

    I am a php newbie, and I could only find this discussion in the past that could help:

    http://mu.wordpress.org/forums/topic.php?id=7180
    http://mu.wordpress.org/forums/topic.php?id=9241

    I was stumped by the information and was confused on how to get the link to the blog with the description. Can anyone help me on this?

  2. redsoxmaniac
    Member
    Posted 14 years ago #

    I am going to ask this again.

  3. cafespain
    Member
    Posted 14 years ago #

    Except you haven't asked it again. You've merely stated that you are going to ask it again, without actually fulfilling your intention by actually asking it again.

  4. cafespain
    Member
    Posted 14 years ago #

    In answer to your question. Do you see anywhere else in MU that gives you a list of all your blogs either in a row or in a drop down?

    If you do, in all likely hood it's using a function to return that list. Have a look in the php file and see what function is being called - you can then use that to build your drop down.

  5. tdjcbe
    Member
    Posted 14 years ago #

    And it was still on the front page of the forums. Some of us do occasionally get some sleep. I know it's a shock to some but I paid good money for that bed and damnit, I'm going to sleep in it on occasion. (Actually I sleep on my couch but you get the idea.)

    A search for "list all blogs" will turn up a number of previous threads on the topic as well as at least one tutorial and some plugins.

  6. cafespain
    Member
    Posted 14 years ago #

    Sleep? Sleeeep? Slllleeeeppp? I do not know this word. What is this sleep you speak of? and how can one such as I go about attaining such a thing?

  7. redsoxmaniac
    Member
    Posted 14 years ago #

    Sorry for being quick. Thanks for the information. I will start from this and see what I can come up with.

  8. SimpTech
    Member
    Posted 14 years ago #

    What I've done here is to create a template called blogs (using page.php as an example).

    <?php
    /**
     * @package WordPress
     * @subpackage Default_Theme
     */
    /*
    Template Name: Blogs
    */
    ?>
    
    <?php get_header(); ?>
    
    <!--Main Content-->
    <div class="mcon">
    
    <div class="pgNav">
    
    <?php
    
    $current_site = get_current_site()->id;
    
    $blog_list = get_blog_list( 0, 'all' );
    
    $blogs=array();
    
    foreach ($blog_list AS $blog)
    {
    
        $blogid = $blog['blog_id'];
    
        if ($blogid != $current_site) {
    
        $name = get_blog_details($blogid)->blogname;
        $description = get_blog_option($blogid, 'blogdescription');
        $url = get_blog_details($blogid)->siteurl;
        $blogs[] = "$name, $description, $url";
    
        }
    
    }
    
    sort($blogs);
    
    echo '<h2>Blog List</h2>
    
    ';
    
    foreach ($blogs as $blog)
    {
    
        list($name, $desc, $url) = split(",", $blog);
        echo '<p><a href="'. $url .'">' . $name . '</a><br />
    '.$desc.'</p>
    ';
    
    }
    
    ?>
    
    	</div>
    
    <!--End Content-->
    
    <?php get_sidebar(); ?>
    
    </div>
    
    <?php get_footer(); ?>

    Call this blogs.php and place under your template folder (wp-content/themes/[theme_name]). Create a new page, leave it blank and use the blogs template.

    Example: http://smallnetbiz.com/blogs/

  9. wikichaves
    Member
    Posted 14 years ago #

    Hi SimpTech

    Nice Script :)

    I have a question for you.

    How can i order the list by blog ID ?

    Regards,
    Wiki

About this Topic

  • Started 14 years ago by redsoxmaniac
  • Latest reply from wikichaves