Take Complete Control Of Your WordPress Menu

I don’t normally post lists of plugins but for the first time ever my WordPress menu is completely controlled by WordPress itself in a smooth and efficient way. All thanks to some awesome plugins that you need to put in your WordPress management arsenal—right now. No more custom coding. No more hurried hacking when I change themes. Install these 3 plugins and stop worrying about your WordPress menu.

Continue reading “Take Complete Control Of Your WordPress Menu”

Customize Your Posts Without Touching Your Theme Files

I hate editing my WordPress theme files—and I’m a theme developer! It makes it a pain to update the theme when a new, better version comes out. And if you ever change your theme you’re either going to forget about some crucial edit you’ve made, or spend wasted hours hunting down all your customizations. Didn’t we decide to use WordPress because it was so simple to use?

Well, it is simple to use. The secret is to write a quick plugin. The really big secret is it’s not that hard.

Continue reading “Customize Your Posts Without Touching Your Theme Files”

Adding Class To The WordPress Page Menu

Problem: You need to add a class or id to the the unordered list in wp_page_menu. Maybe to implement some super-slick drop down page menus. But! That <ul> tag is trapped inside of wp_page_menu. What are you going to do?

Solution: Filter wp_page_menu. In the code example below we’ll use preg_replace to find the first—and only the first—<ul> tag and swap it out for <ul id="nav" class="something-classy">. Just drop this code snippet into your theme’s functions.php file and you’re set.

// Add ID and CLASS attributes to the first <ul> occurence in wp_page_menu
function add_menuclass( $ulclass ) {
  return preg_replace( '/<ul>/', '<ul id="nav" class="something-classy">', $ulclass, 1 );
}
add_filter( 'wp_page_menu', 'add_menuclass' );

How I Used A Custom Page Template To Redesign My Blog The Smart Way

The custom front page is a must for really taking control of your WordPress installation and using it to manage your website. Luckily, creating a custom front page is ridiculously easy. It’s something every WordPress tinkerer should tackle at least once.

Take a look at the custom front page I created for ThemeShaper. I’ll tell you exactly how I created it using a custom page template and even let you download the one I’m using here.

revenge-screenshot

Continue reading “How I Used A Custom Page Template To Redesign My Blog The Smart Way”

Collapsing WordPress Widget-Ready Areas & Sidebars

Problem: Theme users need as many widget-ready areas as possible. They’re easy to use and they help keep theme template files clean. But! unused, empty, widget-ready areas, areas waiting for you to add a widget of your choice, hang around waiting to spoil your designs by limiting your styling options. Just as bad, empty widget areas can invalidate your markup. But don’t worry, we can do something about it. Only first, we need to take a closer look at the problem.

Here’s how a typical widget-ready sidebar looks. I’ve taken the code from Automattic’s guide to widgetizing WordPress themes.

<ul id="sidebar">

 <!-- likely awesome stuff -->

</ul>

We’ve got an unordered list and inside of it a statement that looks for the dynamic_sidebar() function. If we’ve registered one, it’ll spit out our awesome stuff: WordPress widgets marked up as list items.

All very good. But what if we start out with no awesome stuff in there? No default widgets? Well, that means our containing ul element will be hanging out there in our site with no li elements in it. A list without list items. Totally invalid and totally unsemantic. Worse yet: what if you were styling that ul with a margin, border, or just positioning it? That styling would stick—even if the widget area was empty. Totally unacceptable.

Thankfully, there’s a fix. Continue reading “Collapsing WordPress Widget-Ready Areas & Sidebars”

Custom WordPress Hooks and Filters in Thematic 0.6

Thematic version 0.6 is an upgrade I didn’t intend on making so quickly and there’s been some changes. Here’s a weird one: when every other WordPress theme author is desperately trying to add more and more settings to their theme options page, I took an option out. Even weirder: it made the theme better. How? I started adding custom hooks and filters to Thematic.

This is something I’ve wanted to get started on for a while so I’m glad it’s finally here.

Custom WordPress Hooks in Thematic 0.6

There are two new custom WordPress hooks in Thematic version 0.6: thematic_belowheader() and thematic_abovefooter(). You can find them in header.php and footer.php, respectively. I’m really excited about this small—but powerful—addition to Thematic. Almost anything you can think of can now be loaded into the theme, just below the header and just above the footer, by taking advantage of your Child Theme functions.php.

Now, I haven’t done anything exciting or creative with this yet—that I can show you—but here’s the outline of some functions that’ll get you started on taking advantage of the new hooks. Remember, these go in the functions.php of your Child Themes.

// Hook into the area below the header
function childtheme_helloworld() { ?>
     <h2>Hello World!</h2>
<?php }
add_action('thematic_belowheader','childtheme_helloworld');
// Hook into the area above the footer
function childtheme_goodbyeworld() { ?>
     <h2>Goodbye Cruel World!</h2>
<?php }
add_action('thematic_abovefooter','childtheme_goodbyeworld');

There you have it. That’s all you need to get started with the Thematic custom WordPress hooks. Fool around with it. Try it out with WordPress conditional tags. See what you can come up with.

Now for the filters. I think you’ll be impressed with the power filters give you over your theme. Continue reading “Custom WordPress Hooks and Filters in Thematic 0.6”

WordPress Theme Release Post Template

In response to How to get featured in our Daily Releases on Weblog Tools Collection, I’ve made a template for posting your WordPress theme releases to the Weblog Tools Collection forum that will help ensure you get your Theme featured there. Here it is for anyone that wants to use it. Enjoy.

WordPress Theme Authors: In response to How to get featured in our Daily Releases on Weblog Tools Collection, I’ve made a template for posting your WordPress theme releases to the Weblog Tools Collection forum. Here it is for anyone that wants to use it. Enjoy.

<strong><a href="" title="Theme URL">Theme Name</a></strong>
License: license-type

Short description of the theme. Widget ready? Supports gravatars? Options page? One, two or three column theme? What colors is it available in? Is the header customizable?

<ul>
<li>Point one</li>
<li>Point two</li>
<li>Point three</li>
</ul>

<a href="" title="Theme Demo">Theme Demo</a> or <a href="" title="Theme Screenshot">Screenshot</a>

Feel free to use or adapt for your own theme releases.

Hide all your links

Want to concentrate solely on typography and foundational structure while you’re designing your next WordPress theme? Hide all your links. Make them black. Get rid of the underline and make them blend in. Destroy all visual evidence of hypertextuality. Show no mercy as you attack the lists and paragraphs and headings that shore up your content and don’t let anything distract you from your end goal: typographic excellence.

Assuming you’re starting with a white background and black text, CSS makes it relatively easy to exterminate anchors with extreme prejudice:

a {
color:#000;</code><code> text-decoration:none;
}

There. Now go make something beautiful.

While you’re at it, try hiding your header and sidebar in The Ultimate WordPress Theme Test.

How To Build WP-PageNavi Into Your WordPress Theme

WP-PageNavi, from Lester “GaMerZ” Chan, gives you an awesome upgrade to your WordPress post-page navigation. Instead of the typical “Older Post/Newer Post” links, you get “Digg-like” pagination. Like so:

Wp-PageNavi Sample

Very cool. But what if you want to incorporate it into a WordPress theme for release? How do you style it when the instructions tell you to modify the plugin files? Good questions. I’ll tell you how. Continue reading “How To Build WP-PageNavi Into Your WordPress Theme”

A Proposal for Theme Management in WordPress

The handling of plugins in WordPress 2.5 is perfect. It’s superb. It’s easy. It’s cake. But now that I have cake, you know, I want to eat it too. I’ve got a proposal for how upgrading of themes should be handled in WordPress 2.6 (or whenever) using a .org theme repository. Maybe more like a couple of ideas. But watch out! My first item is going to be somewhat controversial amongst theme authors.

Use WordPress Theme Options to Store Footer Text

What prevents people from upgrading their WordPress theme? Changes they’ve made to the theme file. Ignoring changes made to accommodate plugins, there’s really only one spot a theme user would really want to change and have no apparent control over in the admin area: the text in the footer. Theme authors should hand over that power.

Continue reading “A Proposal for Theme Management in WordPress”

A Better Spot for The WordPress Meta

One of the first things many new blog owners do is remove the Meta section from their sidebars. Great idea. The Meta information is almost completely useless. And I’m not the only one that thinks so.

The Meta section includes some admin links like “Login” or “XHTML Valid.” While those links might be useful for the owner of the blog, they offer no value at all for the reader. The next time you set a WordPress blog up, start by removing the Meta section from the sidebar. Daily Blog Tips

But you know what? It’s only almost completely useless. It has two great functions; it gives you a link to your admin area from every page and it lets you logout from your blog. Pretty handy when you’re on a public computer. How can we fix this up so we don’t look amateurish and still retain the useful functionality? Easy! Conditional tags and Javascript.

Well, kinda easy. If you want to implement this on your blog you’ll have to do some fiddling around with your theme. No guarantees that the following technique won’t make your site explode.

Here’s what we want to do. Only show the login block to logged-in users and while we’re at it take the whole thing out of the sidebar and put it somewhere really useful: in a sliding panel that drops down from the top of the page with a click, wherever you are on the page.

Continue reading “A Better Spot for The WordPress Meta”

Developing Themes: Drupal Compared With WordPress, First Impressions

I love WordPress, let me get that out of the way at the beginning. But Drupal is really powerful. And terribly exciting—you can do so much with it! But I only like Drupal. Bit of a difference.

I’ll let that serve as introduction to letting you know that I have two projects that will require Drupal as a CMS and I don’t think that WordPress will cut it. WordPress, like I’ve said before, makes a great little CMS. But it’s not for everything. One project is a site for a complex and growing organization that will need finely grained user permissions and the other, a hobby site, is something like a Digg-clone for rating and sorting user-generated content. Sort of the standard “you need Drupal” projects. Continue reading “Developing Themes: Drupal Compared With WordPress, First Impressions”