The MU forums have moved to WordPress.org

Add new blogs to a drop down blogroll (8 posts)

  1. dunrite67
    Member
    Posted 17 years ago #

    Ok, so my wordpressmu site is running great, but does anyone know if there is a way that I could create a drop down or something similar that would show a blogroll of the newest sites added?

    for example if I have http://bill.checkmyhead.com and tammie creates http://tammie.checkmyhead.com I would like the other checkmyhead blog owners to know about it. So I was thinking a drop down of the newest blogs would be nice, or automatically add them to a sitewide blogroll.

    Any suggestions?

  2. peiqinglong
    Member
    Posted 17 years ago #

    Try this:

    <?php
    $blogs = get_last_updated();
    if( is_array( $blogs ) ) {
    	?>
    	<ul>
    	<strong>Updated Blogs</strong>
    	<?php foreach( $blogs as $details ) {
    		?><li><a href="http://<?php echo $details[ 'domain' ] . $details[ 'path' ] ?>"><?php echo get_blog_option( $details[ 'blog_id' ], 'blogname' ) ?></a></li><?php
    	}
    	?>
    	</ul>
    	<?php
    }
    ?>
  3. dunrite67
    Member
    Posted 17 years ago #

    wow, very cool, that code creates a nice list, thanks!

    Now I have the list, and I have made a drop down box, now I just need to put them together.

    Here is the code I am using for the drop down, is there a way to fill the options with your code from above?

    <form onsubmit="return false;">
    		<select onchange="window.open(this.options[this.selectedIndex].value);
    			this.selectedIndex=0;">
    			<option>-More Heads-</option>
    			<option value="http://tammie.checkmyhead.com/">Tammie</option>
    			<option value="http://bill.checkmyhead.com/">Bill</option>
    			<option value="http://gothvampres16.checkmyhead.com/">GothVampres</option>
    			<option value="http://davidov.checkmyhead.com/">davidov</option>
    			<option value="http://sullycooldog.checkmyhead.com/">sullycooldog</option>
    			<option value="http://reggiebr.checkmyhead.com/">reggiebr</option>
    			<option value="http://herbalviagra.checkmyhead.com/">herbalviagra</option>
    
    		</select>
    	</form>
    
  4. peiqinglong
    Member
    Posted 17 years ago #

    Yes there is, but my brain is fried and I have a million things on my plate for work at the moment. I'll help where I can and do more when I can. But to get you started, try something like:

    <?php
     $blogs = get_last_updated();
    if( is_array( $blogs ) ) {
    	?>
    	<form onsubmit="return false;">
    		<select onchange="window.open(this.options[this.selectedIndex].value);
    			this.selectedIndex=0;">
    	<?php foreach( $blogs as $details ) {
    		?><option value="<?php echo $details[ 'domain' ] . $details[ 'path' ] ?>"><a href="http://<?php echo $details[ 'domain' ] . $details[ 'path' ] ?>"><?php echo get_blog_option( $details[ 'blog_id' ], 'blogname' ) ?></a></option><?php
    	}
    	?>
            </select>
    	</form>
    	<?php
    }
    ?>
  5. dunrite67
    Member
    Posted 17 years ago #

    heheee. man your good, that worked perfect!

    Only problem is I have it in the side bar right now, so it hangs way off the side, but I can move it to probablly the center.

    Thanks again, this is great code!

  6. peiqinglong
    Member
    Posted 17 years ago #

    You might want to add to your css something like:

    option {overflow: hidden}

    Not sure if that will work, if not, you have to give the form an ID and then use the overflow: hidden and that should do the trick.

    :)

  7. dunrite67
    Member
    Posted 17 years ago #

    thanks again, I will check into that.

    I gotta say that code you sent is working great, it looks so good, and I didn't realize (duh) that the order is based on the most recent blog, that is so cool.

    I just told a forum last night that they could come get a free blog at http://checkmyhead.com so I had like 7 people sign up, and it just adds them perfectly.

    Do you have a site I could link too? I wanted to put the code on my blog and maybe it will help someone else too, but I wanted to make sure to give credit for it.

  8. peiqinglong
    Member
    Posted 17 years ago #

    Sure thing! Glad to be of help, you can link to http://www.bui4ever.com, my personal site.

About this Topic

  • Started 17 years ago by dunrite67
  • Latest reply from peiqinglong