Showing Sitewide recent posts and Tagcloud on a wordpress Mu site

Jotted by brajesh on June 7, 2009

A few days ago,I was working on one of my client’s site ,where I was supposed to show the sitewide recent posts(yes,I mean the most recent posts from all the blogs on the current install of wpmu), on the Home page .I just found these nice plugins,and thought to share them here.

I found this wonderful plugin ,called AHP Sitewide Recent Posts WIDGET for WPMU ,download it from here

It shows the most recent posts from all the blogs.And I liked it because I can extend it anytime to cater to my needs :)

Another ,useful plugin,which got my attention was WordPress MU Sitewide Tags by Donncha( you must be familiar with him, if you have worked with wpmu,he is the lead developer of wpMu).

WordPress MU Sitewide Tags allows you to show sitewide tags just like the wordpress.com hot topics.Have a look here what Donncha has to say.

I liked both the plugins,and I am sure  it is of great worth while developing a wpmu based site.What do you think ?.

[blinklist] [Bloglines] [del.icio.us] [Digg] [dzone] [Facebook] [Ma.gnolia] [Mister Wong] [Reddit] [Sphere] [Sphinn] [StumbleUpon] [Technorati] [Email]


Adding Sitewide Menu Items to a buddypress site

Jotted by brajesh on June 2, 2009

In this post,I will show you the quickest way to add menu items to a buddypress site,sitewide.

As you may be knowing,buddypress-wpmu powered sites need at least two themes,one for the site home page and one for the members profile,group etc(called member theme usually).So,when you want to add more menu items to the top navigation, you have two options.

1.Add the menu links to each of the theme(yes, you will have to add the link in the home theme and the buddypress member theme separately).

2.Simply write a small snippet of code and upload it to mu-plugins directory.It will add the link globally.

Well,let us start with the basics,I will take an example of the buddypress default home theme and buddypress default member theme.

Here is what you get as the top nav,when you install buddypress and activate the default themes

BP default menu

Well,so suppose now you want to add a few links(menu items) in the top navigation.As I mentioned, you have two options.

Option 1:-Go and edit the nav (for default theme,It is in header.php, look into your theme for the location of the menu) in the Buddypress Home theme and buddypress member theme.You are done.But suppose, you have to add/remove some links later ,you will have to again edit both the theme.

Well ,I have a shortcut for you.
Option 2:

Buddypress default theme(or any of the well coded buddypress theme) , provides an action hook “bp_nav_items” ,we can use this action hook to hook our new links into the menu.

Well,again we have two choices now.We can either use the functions.php of each of the theme(Home and member and add our function to add links),but again,this causes redundancy.

So,the better option is , let us define the functions in a new file say  my-extra-links.php(you may name it what ever you like) and define the action function there as

 
<?php
//add the action hook
add_action("bp_nav_items","extra_nav_links");
 
//insert the links now
function extra_nav_links()
{
?>
<li><a href="#">My Link 1</a><li>
<li><a href="#">My Link 2</a></li>
<?php
 
}
?>

Relace the hash(#) with the url of your link,and you are done.ahh ,yes, we have yet to upload the file somewhere.Since,In wordpress Mu,the files(or let us say properly ,the plugins) kept in the wp-content/mu-plugins directory gets automatically activated sitewide,we will use this functionality and upload our file to the mu-plugins directory.
Once, you are done with the uploading of the file to the mu-plugins directory, refresh your site page in the browser ,and you will see something like this
Adding sitewide links

Why you should use this approach:-It will allow you to keep your extra menu items ,even if the themes for buddypress gets changed(the only requirement is the new themes should also be using the action hook “bp_nav_items“).Well,I think, this approach, may reduces a couple of minutes in your development time.
So,what do you think? which approach is better? looking forward to your thoughts on it.

[blinklist] [Bloglines] [del.icio.us] [Digg] [dzone] [Facebook] [Ma.gnolia] [Mister Wong] [Reddit] [Sphere] [Sphinn] [StumbleUpon] [Technorati] [Email]



Get Adobe Flash playerPlugin by wpburn.com wordpress themes