DiggingIntoWordPress

by Chris Coyier & Jeff Starr

Author: Chris Coyier

Specify Unique CSS File Per Post

Posted by on

I’m a HUGE fan of being able to link up a CSS file on a per-page basis. I just find it extremely common that a page needs CSS styling unique to it, and I hate litering a sites main stylesheet with customizations that only one particular page needs. We’ve talked about this before, and even created a custom method for doing so, as well as mentioned the art direction plugin, which makes this easily possible.

Custom Page Titles from Scratch

Posted by on

The titles of pages are controlled by the <title> tag in the <head> section of a website. They are important for all kinds of reasons. Telling the user where they are. The name of the page when bookmarked both locally and socially. They are important for SEO.

What’s the best Caching Plugin?

Really nice article running down the major caching plugins, including some ones I have never heard of. I’m a fan of W3 Total Cache myself, having tried about four of them on various sites. I like the CDN integration, the fact that it doesn’t change your URLs, and that it combines file and database caching. Not to mention it is actively maintained.

Most interesting are the options that turn out to be worse that no caching at all.

CSS-Tricks does nearly 2.5 million pageviews a month and can run OK without caching, it’s just much faster and surge-protected with it on.

Call a Widget with a Shortcode

Posted by on

We covered how to run a shortcode in a widget. But what about inserting a widget with a shortcode? I recently had this situation come up. I had a single page where I just wanted to be able to chuck in a widget without the whole rigmarole of creating a special widgetized area and probably a custom page template for that widgetized area and such. I wanted to just put [widget widget_name="my_widget"] in the pages content and have that widget pop in. Turns out it wasn’t as easy I wanted it to be, but it’s not that bad…

Database Powered CSS in WordPress Themes

“A popular ability in WordPress themes is to add custom CSS driven by options. This brings up a common question, how should the theme inject custom CSS? I’ll outline three different approaches on how to do this.”

Display “Time Ago” for Posts or Comments

Turn regular datestamps into more human-readable text (e.g. 22 minutes ago) via a built-in WordPress function.

Update 2014/02/08: 404 link removed: http://www.upthemes.com/2010/03/wordpress-master-tip-display-time-ago-for-posts-or-comments/

Custom Post Types in WordPress 3.0

Still confused about these “custom post types”? We already have categories for Posts and we can use various techniques like post_class to target certain posts with CSS and do different styling. We can also use conditionals to treat posts in different categories completely differently. Why is this going to help?

The big difference is that it actually adds sidebar links to the Admin side specifically for these new types. And beyond that, you can actually declare custom data types for different types. Instead of just “Add Post” and “Add Page”, you can have “Add Real Estate Listing”, which only will ask for “Property Name”, “Description”, “Price”, and “Sale Status”. Powerful stuff!

.net Mag, The web pro’s guide to WordPress

I just got my hands on issue #199 of .net Mag. I did an article for it on WordPress, and it’s on the cover!

They did use the wrong W for the cover, but I’m sure they got enough flack for it they won’t mess that up again =). This is probably practically an old issue for UK folks, but big bookstores in the U.S. I find do tend to stock this magazine (Sold as “Practical Web Design” in the U.S.) but always a few issues old, so I bet you could find it around about now.

Declare Multiple Widgetized Areas

Posted by on

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.

Code is poetry