Bigger changes
You’ve no doubt noticed the major styling changes here at rtv6blogs.com, but what we’ve done goes much deeper than just cosmetics. The main blog has been supercharged to help both our contributors and our readers.
If you’re reading this, then you probably already know we use WordPress MU to power our blogging ventures. It’s proven to be the easiest for our bloggers to learn and the easiest for administrators (read: me) to customize.
We borrowed a page from the WordPress.com playbook and decided that the main blog should be more than a dumping ground for blog lists and links to login pages. Plus, what site administrator wants dozens of links each going to a blog’s wp-login.php page? That just seems to be asking for trouble.
So here’s a quick little overview of exactly what we did (and a sneak peek of what’s coming to all of blogs in the not-too-distant future).
- Google’s Custom Search Engine
Get search results from the entire WPMU install, without using any extra plugins. (How we did it) - Global Blog List
Depending on who you are, you can get different information here. Regular visitors get links to all of our different blogs. Logged in users get links to the blogs and each blog’s Dashboard. And administrators get the same links as users, plus links to comment and stats pages within /wp-admin. (How we did it) - Log In form
Sign in to rtv6blogs.com, then you’re presented with links to your primary blog’s Dashboard, write a new post page, edit profile page and logout. (How we did it) - Our latest posts
The latest posts from the root blog at rtv6blogs.com. (How we did it) - Randomly picked for you…
A random post using the plugin “Featured-Posts” to pull a title, the excerpt, post author, published date and blog. (How we did it) - Most recent posts
Using “WordPress MU Latest Posts,” we pull in the titles and author IDs from the latest 5 posts sitewide. (How we did it) - Latest trending tags
Then we use “WordPress MU Sitewide Tags Pages” to generate a sitewide tag cloud on the main blog. (How we did it) - Latest rtv6blogs.com posts
Then we use “Sitewide Multi-Widget” to pullĀ in the latest 10 post titles and each post’s author. (How we did it)
Here’s how we made it all happen:
- Google’s Custom Search Engine (CSE)
- Visit Google to set up an account
- After you set up your CSE, go to the search engine’s Control Panel and select “Host results on my website using an iframe”
- Enter your URL with “/index.php?” at the end
- Select “Top and Bottom” for ad placement
- Copy the code and place it in the proper places within your theme (searchform.php and search.php)
- If the results from Google are too wide on your site, go to your search.php file change “var googleSearchFrameWidth = 600″ to “var googleSearchFrameWidth = 500″ to narrow the results
- Global Blog List
- Make a template called “blog-list.php” and add the following code
-
<?php $user_id = get_current_user_id(); ?> <?php if (have_posts()) : ?> <?php while (have_posts()) : the_post(); ?> <div class="post" id="post-<?php the_ID(); ?>"> <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2> <?php endwhile; ?> <?php endif; ?> <ul> <?php $blog_list = get_blog_list( 0, 'all' ); foreach ($blog_list AS $blog) { $blog_name = get_blog_option ( $blog['blog_id'], 'blogname' ); ?> <li><?php if ($user_id != 0) { ?>Blog <?php echo $blog['blog_id'] ?> <small>(<a href="http://<?php echo $blog['domain'].$blog['path'] ?>wp-admin/" title="<?php echo $blog_name ?> - Dashboard">Dashboard</a>)</small> is <?php } ?><a href="http://<?php echo $blog['domain'].$blog['path'] ?>" title="<?php echo $blog_name ?>"><?php echo $blog_name ?></a></li> <?php } ?> </ul> <?php if ( $user_id == 1 || $user_id == 21 || $user_id == 31 ) { ?> <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Site Stats">Site Stats</a></h2> <ul> <?php $blog_list = get_blog_list( 0, 'all' ); foreach ($blog_list AS $blog) { $blog_name = get_blog_option ( $blog['blog_id'], 'blogname' ); ?> <li><a href="http://<?php echo $blog['domain'].$blog['path'] ?>wp-admin/admin.php?page=cystats-time" title="<?php echo $blog_name ?>">CyStats by <em>TIME</em> for <strong><?php echo $blog_name ?></strong></a></li> <?php } ?> </ul> <?php } ?> </div> - Line 15 sets up restricted access for blog administrators.
- Log In form
- In your home.php file add the following code
-
<?php global $user_ID, $user_identity, $user_level ?> <?php if ( $user_ID ) : ?> <?php $primary_blog = get_active_blog_for_user( $current_user->ID ); ?> <h2>Your account</h2> <ul>Welcome, <strong><?php echo $user_identity ?></strong>. <li><a href="<?php bloginfo('url') ?><?php echo $primary_blog->path; ?>wp-admin/" title="Dashboard">Dashboard</a></li> <li><a href="<?php bloginfo('url') ?><?php echo $primary_blog->path; ?>wp-admin/post-new.php" title="Write a post">Write a post</a></li> <li><a href="<?php bloginfo('url') ?><?php echo $primary_blog->path; ?>wp-admin/profile.php" title="Profile">Profile and personal options</a></li> <li><a href="<?php echo wp_logout_url(get_bloginfo('url')); ?>" title="Logout">Logout</a></li> </ul> <?php else : // ( get_option('users_can_register') ) : ?> <h2>Log In</h2> <ul> <form action="<?php bloginfo('url') ?>/wp-login.php" method="post"> <label for="log"><input type="text" name="log" id="log" class="s" value="<?php echo wp_specialchars(stripslashes($user_login), 1) ?>" size="20" /><br />User</label><br /> <label for="pwd"><input type="password" name="pwd" id="pwd" class="s" size="20" /><br />Password</label><br /><br /> <input type="submit" name="submit" id="loginsubmit" value="Log In" class="button" /><br /> <label for="rememberme"><input name="rememberme" id="rememberme" type="checkbox" value="forever" /> Remember me</label><br /> <input type="hidden" name="redirect_to" value="<?php echo $_SERVER['REQUEST_URI']; ?>"/> </form> <a href="<?php bloginfo('url') ?>/wp-login.php?action=lostpassword">Recover password</a> </ul> <?php endif // get_option('users_can_register') ?>
- Our latest posts
- This is simply the regular loop for the main blog running in home.php
- Randomly picked for you
- For this feature you need to use “Featured-Posts” by Daily Testimony
- Upload the plugin to /mu-plugins/
- Simply add the blogs you want to pull posts from to
$featured_blogs
on line 16 of featured-posts.php.
- Most recent posts
- For this feature you need to use “WordPress MU Latest Posts” by Kandar
- Upload this plugin to /plugins/ and activate on your main blog
- Add
$auth_desc = get_usermeta($id_author, 'description' );
to line 145. This grabs the user’s bio, if you want to display this on your front page
- Add
$results['auth_id'] = $id_author; $results['auth_desc'] = wpmu_cut_article_by_words($auth_desc, $how_many_words_desc);
to wpmu-latest-posts.php at the end of the grouping around line 150. This will preserve the author’s ID in a variable so it can be called in home.php. To bring up the author’s photo we use
<?php bloginfo('stylesheet_directory'); ?>/images/heads/<?php the_author_ID(); ?>.pngand save each author as their ID number. For example, the admin’s photo is 1.png
- Then we add the post titles and photo to home.php
<div id="site-recent-wrapper"> <h2 class="header">Most recent posts</h2> <?php $start_from = null; $how_many = null; $how_long_day = 10; $how_many_to_appear = 5; $how_many_words = 30; $clean_post = true; $short_by = 'post_date'; $how_many_words_desc = 50; $latest_posts = wpmu_latest_post($start_from, $how_many, $how_long_day, $how_many_to_appear, $how_many_words, $clean_post, $short_by, $how_many_words_desc); foreach($latest_posts as $latest_post){ ?> <div class="site-recent"> <div class="site-recent-author"><img src="<?php bloginfo('stylesheet_directory'); ?>/images/heads/<?php echo $latest_post->auth_id ?>.png" alt="<?php echo $latest_post->author_name ?>" align="left" /></div> <div class="site-recent-post"> <h2><a href="<?php echo $latest_post->guid ?>"><?php echo $latest_post->post_title ?></a></h2> </div> <div class="clear"></div> </div>
- Latest trending tags
- For this feature you need to use “WordPress MU Sitewide Tags Pages” from Donncha O Caoimh
- Upload the plugin to /mu-plugins/
- In your Dashboard, go to “Site Admin” > “Options” and at the bottom set the options for “Global Tags” as you want
- Then add the call for the tag cloud to home.php
<div id="site-tags"> <h2 class="header">Latest trending tags</h2> <?php $tags_blog = get_site_option( 'tags_blog_id' ); ?> <?php switch_to_blog(19); ?> <?php wp_tag_cloud(); ?> <?php restore_current_blog(); ?> </div>
On line 4 replace “19″ with the blog ID of your brand new tag blog
- One tip, if you’re having trouble with the permalinks to the tags, modify your permalinks on the new tag blog
- Go to “Settings” > “Permalinks”
- Change “Tag base” to
blog/tag
- Latest rtv6blogs.com posts
- For this feature you need to use “Sitewide Multi-Widget” from D. Sader
- Simply go to “Appearance” > “Widgets” and enable the widget in one of your sidebars
A final suggestion.
After doing all or any of these, go through and resave each blog’s permalink settings. We ran in to problems with the “Most recent posts” linking to rtv6blogs.com/y.xxxx where y=blog_id and xxxx=post_id. The permalink re-save solved the problem.
What things do you like or dislike? Questions? Feel free to comment below



