Working on a new theme for the next Digging into WordPress book update, I found myself really getting into the whole “widgetizing” thing. Widgets enable non-technical users to customize your theme according to their specific layout needs, and with so many different widgets available, the possibilities are endless. You may have thought about widgets as something you do in the sidebar, but there is no reason to stop there. You can widgetize just about every part of your theme. In this post, we’ll show you how to do widgetize your theme in two easy steps. Once we get the basics down, we’ll dig into some sweet tips and tricks.
Our personal collection of useful ways to customize and format the WordPress
Everyone who has been using WordPress for any length of time should be familiar with the
--more--> tag. When you are writing a post, inserting the
--more--> tag within the post text will create an excerpt out of any text/markup that precedes it. The post will then show the default “more...” link that readers may click to view the entire post. When the
more tag is used, the post’s excerpt will be displayed on all non-single views, such as category, tag, and archive views; the entire post content will only be displayed when the single-post view is displayed. Let’s look at a quick example..
A reader recently asked about how to develop a theme on a live site such that:
- All visitors will see the current theme
- Only the designer will see the new theme
- All site plugins will work with the new theme
- Smooth transition between old and new theme at launch
These are the main concerns, but there are a few other details that need addressed to ensure smooth theme development on a live site. Let’s take a look at how to achieve these goals and effectively develop themes behind the scenes..
When someone comments on your site, cookies with the information the entered are saved to their computers. WordPress makes it easy to access that information. In fact, in your comments.php template they are ready-to-go PHP variables you can spit out anywhere you’d like. Let’s take a look.
Let’s say you want to have a special theme for your WordPress site for mobile users. You don’t want to use a pre-canned solution or anything third-party, you just want to create and design the theme yourself. So what you need to happen is for the site to detect mobile users and server up an alternate theme instead. Here is how I might do it.
Importing and displaying feeds in your WordPress themes is a great way to share additional content with your readers. Some good examples include:
By default, WordPress generates a RSS feed for the comments on every post. Many sites take advantage of this by offering the feed next to the comments area, enabling anyone to stay current with conversation. A typical feed menu for many blogs includes the following items:
The month of November is National Novel Writing Month (or #NaNoWriMo). Joel Goodman is participating and thought that the WP Typo theme would be a good fit for it. Joel has expanded upon theme, offering an options page with various different typography choices, better integrated site registration, and some design tweaks. It is now called Modern Linguist (404 link removed 2013/02/08) and is available on his site for free download.
You don’t want to go putting HTML tags directly into post titles. It might show up OK on your own site, but it can be problematic. For example, your titles through RSS will show the tags as next, not render them. I was wishing for a plugin to handle this better, but until then, here is almost-as-simple way to go about it.
When you are building a theme, and the circumstance comes up where you need to create a link to a specific page hard-baked right into the theme, there is a function you should be using.
Now that we have seen how to setup Tumblr-style posts, it would be nice to be able to segregate the Tumblr-posts category from the main feed into its own, separate feed. This would enable readers to subscribe exclusively to the Tumblr-posts feed and maybe display it in their sidebar or something. While we’re at it, it would also be cool to be able to provide readers with a full menu of feed choices, including the following:
WordPress is a CMS. The whole idea being to manage content and make websites editable without having to wrangle code. Any theme can handle Posts and Pages, but what about those “smaller” areas. Little chunks of text placed around a design like a small “about” section, or the copy in the footer of a website. A lot of times this text is hard-baked right into the theme, which isn’t a very friendly way to do things, as it can’t be updated by average Joe user.