After taking the time to set a whole bunch of theme options, it's nice to be able to make a quick backup of your theme settings. Many themes have this functionality built-in, but for themes that don't, here is a plug-n-play snippet to create a "Backup/Restore Theme Options" page. You can see the snippet in action in the shapeSpace theme.
An easy way for visitors to enter their emails is by commenting on a post. We did this recently for people to sign up for a notification email. Instead of using a plugin or custom function for a one-time email list, we just went with WordPress core functionality and used post comments for people to sign up. Then the trick then is retrieving the comment information from the database for the specific sign-up post.
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.
Recently I worked on a project where a single RSS feed was imported and displayed in multiple columns on the web page. Certain pages display feed items in two columns, others in groups of three or more. This technique uses WordPress' built-in
fetch_feed functionality to parse external feeds, and a slice of PHP magic to display them in multiple columns. It's flexible too, enabling any number of columns and feed items from anywhere in your theme/template files. For example, you could display any of the following:
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 DiW post, we'll explore these techniques to get a better understanding of when and how to use them in your WordPress themes.
WordPress makes it easy to publish content in any number of categories, with any number of tags, and with any type of custom post format. So for example, in addition to full articles, you could also offer screencasts, links, side posts, tweets, and all sorts of other peripheral content. Complementary material may work great for visitors surfing around your site, but including all of that extra stuff in your RSS feed dilutes the potency of your main articles. The idea here is that your visitors will subscribe to the more focused content.
WordPress provides a variety of ways to redirect logged-in users. In this DiW post, we explain each of these methods along with some useful tips and tricks along the way. These techniques enable you to redirect logged-in users to internal pages, external pages, and even return them to the current page.
One of my other blocks, CSS-Tricks, has been around a number of years now. There are nearly 1,400 unique pages of content almost all of which have a comment thread. I had a feeling that in the last four years, despite fairly steady growth in traffic and subscribers, that the number of comments per post has dropped. But how to prove it? I don't know of a way to easily see that data.
Quick WordPress tip for you today! A reader recently asked about displaying the total number of blogroll bookmarks on their site. This sounds simple enough but not everyone meddles with code these days, so here is a nice PHP snippet that will do the job:
Save time by replacing your most commonly typed words and phrases with WordPress shortcodes. For example, if you are frequently typing your blog’s URL, you could place the following code your theme’s
In our recent post on pimping the wp-config.php file, we explain that using strong Security Keys is an important part of securing your WordPress installation. In this post, we want to zoom-in on Security Keys and look at what they are, how they work, and how to use them to greatly improve the security of your site.
Easily, the most important file in your WordPress installation is the
wp-config.php file. It serves as your site’s base configuration file, controlling key aspects of WordPress’ functionality and enabling WordPress to do mission-critical stuff like connect to the database. Without
wp-config.php, WordPress simply won’t work. So whenever you install WordPress, one of the first things to do is pimp your
wp-config.php with some custom WP configuration tricks.
One thing that WordPress doesn't have the ability to do "out-of-the-box" is do includes, in the sense of including the content of one post into the content of another post directly in the post editor. For the umpteenth time around here, shortcodes to the rescue!
One of the nice things about using WordPress’ new post-thumbnails feature is that they provide tons of flexibility in terms of where and how you display your post thumbnails. By design, post thumbnails are not included within post content, so they will not be displayed in your blog posts unless you call them specifically with the proper template tag: