Declare Multiple Widgetized Areas

Posted on: March 18, 2010 by Chris Coyier

Have a bunch of different areas you wish to declare as a widgetized area? Save repetative code by creating a quick array of their names, then loop through that array calling the register_sidebar() function on each one. Elementary PHP stuff here, but hey, it just saved me quite a few lines of code in a widget-heavy theme I am working on.

if ( function_exists('register_sidebar') ) {

    $allWidgetizedAreas = array("Homepage Left", "Homepage Right", "Sidebar One", "Movies", "Admin");
    
    foreach ($allWidgetizedAreas as $WidgetAreaName) {
    
        register_sidebar(array(
           'name'=> $WidgetAreaName,
           'before_widget' => '<div id="%1$s" class="widget %2$s left half">',
           'after_widget' => '</div>',
           'before_title' => '<h3 class="widgettitle">',
           'after_title' => '</h3>',
        ));
    
    }

}

Keep Reading

Thumb for Declare Multiple Widgetized Areas

Drag to your bookmarks bar, click, get a bunch of buttons for easy access to specific areas of your WordPress admin. No security concerns, other than taking people to your log in page, so assuming you have a good strong password you are fine. Also I suppose this assumes you have WP installed at the root…

WordPress has a bunch of AJAX abilities built in that you can access, without having to use any outside resources. Gary Cao shows how, pointing out good and bad practices.

6 Ways to Display WordPress Post Content in Multiple Columns

Posted on: March 16, 2010 by Jeff Starr

Most blogs display their content in single columns, but it’s also possible to display content in multiple columns. Multiple-column layouts are perfect for newspaper and magazine-style themes. Here are six ways of getting the job done.

  1. Using CSS3 and progressive enhancement
  2. Multiple columns by filtering the_content
  3. More flexible multiple columns
  4. Multiple loops displayed in multiple columns
  5. Display your posts in horizontal display order with two columns
  6. Bonus: Display your category list in two columns

1. Using CSS3 and progressive enhancement

I think the easiest way to display your content in multiple columns is to apply a little CSS3 in progressively enhancing fashion. Let’s say you have the following markup:

<div class="content">
	<p>Lorem ipsum..</p>
	<p>Lorem ipsum..</p>
	<p>Lorem ipsum..</p>
</div>

Keep Reading

Thumb for 6 Ways to Display WordPress Post Content in Multiple Columns

Add Classes to post_class

Posted on: March 12, 2010 by Chris Coyier

The post_class() function in WordPress is pretty darn useful. It is used like this, in most templates, in a wrapping div of all the content you are outputting:

<div <?php post_class() ?> id="post-< ?php the_ID(); ?>">
   <!-- Post stuff -->
</div>

I was in a circumstance where I wanted to add an additional class to what that was outputting. My thought process went like this:

  1. Arg. I guess I’m going to have to write a function to filter the output of that function. Let’s begin the research.
  2. Wait. I bet that function has an alternate that returns a string rather than echos it. I’ll just use that, and echo it out along with my own custom class.
  3. Double wait. I bet those smart WordPress folks have thought of this…

Keep Reading

Thumb for Add Classes to post_class