Posts categorized: Theme
Donkey work is really the last thing I want to be doing. Piddly tasks that could have been avoided with a little thought and perspective. In this DigWP tutorial, I explain how I worked my way away from becoming a donkey with a dozen child themes to manage and maintain, with just a little knowledge of a native WordPress function.
A cool trick you can do with WordPress is display information directly from your theme's
style.css stylesheet. I recently used this on a site where the theme's version number is used throughout the template to keep things current and consistent.
WordPress does an excellent job of keeping track of what's happening with the loop, but once you start customizing parameters and setting up multiple loops, it's a good idea to explicitly reset them using one of three WordPress template tags. In this DigWP post, we'll explore each of these three loop-reset techniques to get a better understanding of when and how to use them in your WordPress themes.
Tiny little fun idea by Dave Rupert.
At the heart of the WordPress theme template is the venerable WordPress loop. When you're looking at your
index.php file, for example, the loop is the part that typically begins with
if(have_posts()) and contains all the tags and markup used to generate the page. The default loop works perfectly well for most single-loop themes, but for more advanced designs with stuff like multiple and custom loops, more looping power is needed. Fortunately, WordPress provides plenty of flexibility with four or five ways to loop:
In this DigWP post, we transform three slices of code into a clean & stylish tabbed menu that visitors can use to login, register, and recover passwords from anywhere on your site.
There are too many features and details to explain up front, so take a moment to check out the working demo to see the finished product.
One of the themes that is an exclusive download to all you good-looking people that purchased The Book is the All AJAX theme. The idea behind it is that the page never1 reloads. Whenever an "internal" link is clicked, the main content area replaces itself with content that is fetched via Ajax. So posts, pages, search results, and everything else loads right there on the same page. This gives your visitors a smooth, "app-like" experience.
Once a WordPress powered site starts getting quite a bit of content, the default built-in search becomes fairly useless. It just isn't very smart. If you wrote a comprehensive article about He-Man, but since have written five other articles that just mentioned He-Man in passing, a search for "He-Man" will turn up your comprehensive article sixth. There have been various tweaks and plugins and whatnot that attempt to improve upon this default functionality. But why not leverage the best search engine ever written instead?
This chart is one entire page in our book, but I thought it would be good to focus on specifically. Template hierarchy has gotten a bit more advanced since the last time we covered it.
The idea is that WordPress will look for files in a theme to use to render the current page in a specific order. For example, let say you have a page for showing posts from a certain category like this. On this site, all our category pages are currently the same and use "archive.php" template. This file is pretty far down the hierarchy, and is shared with other types of views, for example, tag and category pages.
I've never been a big fan of "theme frameworks." I quite like hacking up WordPress myself and making it do the things I want it to do. I feel like most theme frameworks have a ton of custom functions for you to "help" in doing that kind of stuff. For example, adding a block of text to the sidebar, adjusting the layout, or building a custom menu.
In a recent post, we show you how to clean up and enhance the functionality of WordPress with a custom functions.php template. In that post, we explain how using a custom
functions.php template can speed up development while optimizing many key aspects of WordPress. In this post, we deliver another prime collection of 15 custom functions to enhance your WordPress site. These functions provide all sorts of useful functionality, including stuff like:
When designing WordPress themes, I always add a common set of custom functions to the theme’s
functions.php file. This speeds up development time because I don’t have to hunt for and individually copy the same slew of functions for every theme. I just drop in a copy of my functions.php template and build up from there. This takes care of all those little things that always need to be done for every theme. You know, things like:
With WordPress, displaying all the comments on a Post or Page is incredibly easy. In your theme's
single.php file you probably have a line like this: