Posted by : Chris London in (News, Programming)

WordPress Just Got Jazzy! Version 3.0 released.

Well the new WordPress has been out for a week now and it’s time we give out our two cents. Named after the famous jazz musician Thelonious Monk (I would’ve named it “Satchmo” after my favorite jazz musician Louis Armstrong), this major release is a big sigh of relief for all WordPress developers out there. Finally we can give the user some flexibility without being flooded with update requests.

If you haven’t watched it, here’s a video overview of the new WordPress

Changeable Backgrounds

This is the easiest thing to set up. Just make sure your <body> is as follows:

<body <?php body_class(); ?>>

Changeable Headers

With the advent of changeable headers, headers can be assigned for each individual post! The function to call the header image’s source url is:

<?php header_image(); ?>

Here is the code included in the new theme that shows you how to use post thumbnails and header images:

<?php
// Check if this is a post or page, if it has a thumbnail, and if it's a big one
if ( is_singular() && has_post_thumbnail( $post->ID ) &&
      ( /* $src, $width, $height */ $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'post-thumbnail' ) ) &&
      $image[1] >= HEADER_IMAGE_WIDTH ) :
   // Houston, we have a new header image!
   echo get_the_post_thumbnail( $post->ID, 'post-thumbnail' );
else : ?>
         <img src="<?php header_image(); ?>" width="<?php echo HEADER_IMAGE_WIDTH; ?>" height="<?php echo HEADER_IMAGE_HEIGHT; ?>" alt="" />
<?php endif; ?>

Manageable Drop-down Menus

We now have a menu editor in WordPress. It’s some great stuff. Here is a code snippet that will try to add the wp_nav_menu. If there isn’t one it will add the wp_page_menu. This code will choose the ‘primary’ position menu. If one isn’t assigned it will use the one with the lowest ID.

<?php wp_nav_menu( array( 'container_class' => 'menu-header', 'theme_location' => 'primary' ) ); ?>

Custom Post Types

A new function has been created called “register_post_type” which allows plugin developers the ability to create a new post type. For example, you can create a plugin that sends newsletters to people. You can make a new post type called “Newsletters” that allows the user to create newsletters that are not only sent to people but are searchable posts in the user’s blog. Here is an example that creates the post type “Newsletters” and makes it public for the site:

add_action( 'init', 'create_post_type' );
function create_post_type() {
   register_post_type( 'newsletters',
      array(
         'labels' => array(
            'name' => __('Newsletters'),
            'singular_name' => __('Newsletter')
         ),
         'public' => true,
      )
   );
}

MU + WordPress

Thanks to the new version of WordPress you can now run multiple blogs from the same WordPress installation

Conclusion

If you haven’t upgraded yet, then do it today! It’s awesome!

Share and Enjoy:
  • Facebook
  • Twitter
  • Add to favorites
  • email
  • Google Bookmarks

Make a comment