Categories
Uncategorized WordPress

Let your users pick a header, but not add one

WordPress 3.0 added the ability for themes to easily allow custom headers. Users could pick one that the theme shipped with, or upload their own. But what if you run a branded multisite instance where you don’t want your users to be able to upload their own, but you still want them to easily be able to pick one? Now in WordPress 3.1, you can do just that.

So how do we do this?
Continue reading “Let your users pick a header, but not add one”

Categories
Code Uncategorized WordPress

Remove all default header images in a Twenty Ten Child Theme

Despite the beauty of (and cool stories behind) the default images in twenty ten, If you’re building a twenty ten child theme, there is a chance that you won’t want them to appear as options on the custom header screen. This simple snippit of code in your child theme’s functions.php file will deregister the default images. If you use this, I strongly encourage you to add your own in replacement. Check out my 2010 child theme tutorial to learn more about extending twenty ten.

[php]

function jorbin_remove_twenty_ten_headers(){
unregister_default_headers( array(
‘berries’,
‘cherryblossom’,
‘concave’,
‘fern’,
‘forestfloor’,
‘inkwell’,
‘path’ ,
‘sunset’)
);
}

add_action( ‘after_setup_theme’, ‘jorbin_remove_twenty_ten_headers’, 11 );

[/php]

That’s all. Happy Coding!

Categories
Code Uncategorized WordPress

How to remove a nav menu location in WordPress 3.0.0

This function is in WordPress 3.0.1. You can now just call unregister_nav_menu and don’t need to put it in your child theme

One of the great additions to WordPress 3.0 is navigation menus.  One of the aspects that it contains is the ability for a theme to register a nav menu location and for the user to assign any menu they want to that location.  GREAT!  Except that a missing piece of functionality is the ability for Child Themes to remove a location that it might no longer want.  I’ve created a ticket and submitted a patch, but if you need that functionality now, just add the code below to you child theme’s functions.php file:
[php]
if (! function_exists(‘unregister_nav_menu’) ):
function unregister_nav_menu( $location ) {
global $_wp_registered_nav_menus;

if (is_array($_wp_registered_nav_menus) && array_key_exists( $location, $_wp_registered_nav_menus ) ){
unset( $_wp_registered_nav_menus[$location] );
return true;
}

return false;

}
endif;
[/php]

Then all you need to do is call:
[php]
//Remove Twenty Ten Default Menu Location
unregister_nav_menu(‘primary’);[/php]
At some point after the nav menu is registered. I like to use the init hook.

Categories
Uncategorized WordPress

Building Child Themes

On June 5, 2010 I spoke at WordCamp Chicago on Building Child Themes. Below are some resources on child themes that I thought might be useful if you are setting out to build a child theme.

If you have any questions about my slides, feel free to ask them here.

Categories
Uncategorized WordPress

I’m speaking at WordCamp Chicago

I’m excited to announce that I’m going to be headed to my childhood home metropolitan area to speak at WordCamp Chicago (and not just because it is happening only a few blocks from Mr. Beef on Orleans) . I’ll be presenting a talk entitled Building Child Themes that will be geared toward helping beginning developers take the next step in their child theme development, and solidify best practices for intermediate and advanced developers.  The talk will take place at 2:00pm and is part of the developer track.

I haven’t decided exactly what areas I’ll be addressing, but I plan to draw upon the Thirty Ten and Dirty Ten themes published on this site and the Thematic Theme Options theme that I’ve been working on recently. As I write my talk over the next month, you’ll find more information here. You can can follow my WordPress Feed if you’re looking to keep up to date on it. If you have any specific child theme questions that you’d like for me to address, please comment below.  Chicago, I can’t wait to see you!