I ran into this problem while building a mobile version of a WordPress theme. To support a mobile version, I decided to make a child theme that had bare-bones CSS and other mobile goodies. I wanted this child theme to be active when requests came in from known mobile and handheld devices.
Using the filters ‘
template‘ and ‘
stylesheet‘ in my parent theme’s
functions.php , I was able to override the default theme and use my child theme instead.
I hit a snag though, when using
get_template_part(). It was ALWAYS deferring to my parent theme for files!
After making some modification on the live site using the Theme Editor (a big no no), I decided to create a child theme and make it available for everyone. If you like what you see go ahead and grab the Twenty Eleven Blacktail theme at github.
I’m bundling more functionality into my WordPress themes instead of into plugins these days. The best way I’ve found to handle extra scripts and styles is to use the functions
wp_enqueue_style. These functions are used to setup the scripts and styles we’ll be using for our site. By sticking to these functions, WordPress will include these in the HTML when
wp_head() is called, usually inside our
Stumbled on this today when I setup WordPress to have a static page as the home and another page — a posts page — to show the blog entries. There is NO template tag or single function for this! Not to worry, I made one
Place this in your theme’s
Improvements keep pouring in! Tagology is a theme that transforms your WordPress into a bookmarking app much like Delicious.com. You can see my Tagology at work at b.cuppster.com. Here’s a quick look at the new version:
The major improvements include:
It’s official! Tagology source and downloads can now be found at github. I discovered a great way to push changes to a test or production website using git. Maybe you could have done the same with mercurial, but everyone who’s anyone seems to be using github these days…
Check out Tagology bookmarks at github!
When web programming in PHP it’s not often that you get to delve into the functional-style, but when you do, the moment is truly glorious! Here’s a problem I ran into recently: I wanted a string containing the current post tags but with each prefixed by another string (e.g. our friend the octothorpe ‘#’) and delimited by another string (e.g. a space).
The last few days have seen a fury of activity on Savory. Here’s a brief rundown of the latest features: Bookmarkets and Twitter sharing. Get to know all the features and downloads on the Savory Bookmark page.
When experimenting and testing with WordPress taxonomies sometimes you end up with a lot of junk in the database that wouldn’t look good on a production site or even demoing to friends. In my situation, a lot of foobar tags were used during the testing of my Savory Bookmarks plugin.
A quick search revealed an SQL way of deleting orphaned tags — those with counts of zero that should not be associated with any objects such as posts, pages and custom post types as long as the WordPress taxonomy API was used. Here’s what the query looks like:
If you’re creating an application that uses WordPress for other than a blogging platform, then you might want to consider throwing out its default URL rules. I’ll use my Savory Bookmarks as an example.
Savory uses custom post types to store bookmarks. This means that the WordPress LOOP has to be completly sidetracked to instead query for this post type instead of standard blog posts. In fact, the Savory application does NOTHING with blog posts, archives and categories. So, why not clean up the URL rules and make sure nobody is taking backdoors to unforeseen 404 pages.
There are lots of filters for handling URL re-write rules, but since we’re starting from scratch, we’ll use