Here’s a good bit of code I found in the WordPress MU forums and slightly altered for my own purposes – conditional tag based on blog ID. This will work for WordPress 3.0:

<!-- SWITCH CODE BASED ON BLOG ID -->
<?php
$current_blog_id = $GLOBALS['blog_id'];
if ($current_blog_id == 1) {
<!--Do this for blog ID 1-->
} elseif ($current_blog_id == 2) {
<!--Do this for blog ID 2-->
} else {
<!--Do this as a default-->
} ?>
<!-- end CODE HOMEPAGE BASED ON BLOG ID -->
 

Updated: If you’ve used this tutorial to create subdomain blogs and are having trouble logging into those blogs, here’s a fix I found that worked.
—–
I recently spent many hours — most of it Googling and staring at error pages — trying to get the new WordPress Multisite functionality working on a Windows server. I thought I would share how I finally ended up succeeding.

This tutorial is primarily for people who have control over the Windows server they are working on OR a flexible sysadmin who can make a few changes to the server should you run into problems. I’m assuming you’ve already successfully installed WordPress 3.0 and the basic functionality is working. That’s another tutorial for another time and another blogger.

Continue reading »

 

That’s kind of a mouthful, eh?

With all the talk of organizations using WordPress as their website CMS, it’s pretty surprising some features aren’t yet part of the core code or at least surprising that some hacks aren’t more distributed. A very basic feature I know every news site would want is the ability to post multiple headline stacks on one page and control how many headlines each stack displays.

I’m currently in the process of transforming a very static agency intranet homepage into something more vibrant and news-powered using WordPress and I spent an hour searching for the most fool-proof, direct way to accomplish the display of multiple categories on one page. I thought I’d pass along the best solution I’ve found.

The crux of the problem is that using multiple loops on a single page seems to affect the way each loop displays, and not in a good way. No matter how I tried to reset or rewind a loop, it just caused problems for itself, another loop or the entire page. I used WP Modder’s solution and it worked like a charm.

His usage was slightly different than mine. His setup was:

1) Pull the first few headlines from a particular category and display them in a unique way
2) Then display the rest of the headlines normally without duplicating headlines from the previously displayed category

My setup was:

1) Every post is assigned ONE category
2) Every category will display X number of headlines on the front page and that number will vary depending on the category

To accomplish that, you replace this in every instance of your loop:

<?php while  ( have_posts() ) : the_post() ?>

… with this:

<?php $my_query = new WP_Query('category_name=My Badass Category&showposts=3');
while ($my_query->have_posts()) : $my_query->the_post(); ?>

… obviously replacing the category name and the number of posts to show. Using the same query name multiple times for this purpose may not be kosher, but it works and my page isn’t broken, so I’m sticking with it. Of course, most news sites would assign multiple categories to a post, but, uh, that’s your problem. :)

 


I’ve decided to start using this space more for keeping track of random things I learn that I want to make a record of. I typically scour the internet for a solution, bookmark a site and then completely forget about bookmarks altogether. I figure if I blog about it, it’s more likely to stick with me and I’m more likely to be able to find it later with my site’s search engine. If someone else learns from it, all the better.

I wanted to figure out a way to do a rollover button effect where it looks like the button is being “pushed” when you hover over it. I figured I could achieve the effect by using a drop shadow in it’s inactive state and remove it in it’s active state, but I wasn’t quite sure of the best method to achieve the switch between active and inactive.

After an exhaustive (5 minute) search on Google, I found a solution that was written a gazillion (6) years ago on a Webmaster World forum.

Here’s the trick. Create a mini-sprite where you have the active and inactive states within the same image:

Then use this code in your stylesheet:

.buttons a {
display: block;
width: 146px;
height: 77px;
background: transparent url(http://www.lauragentry.com/wordpress/wp-content/uploads/2010/06/buttons.png) no-repeat;
text-decoration:none;
border:none;
}
.buttons a:hover {
background-position: -153px 0;
}

And this code in your body:

<div class="buttons"><a href="http://lauragentry.com"> </a></div>

Essentially what you’re doing is limiting a DIV to the width of the first half of your image and when you roll your mouse over that image, you shift the image to the left X amount of pixels to reveal the second half of your image. This allows a flicker-free transition and requires no Javascript.

Yay! That’s easy!

In case you want to know how to create a similar button style, there are a variety of ways to accomplish this, but I used Illustrator. For a quick read on creating buttons in Illustrator, give this short tutorial a try.