Posts tagged: tricks
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:
Recently, WP-Mix posted an incredibly useful technique that uses a shortcode to add private content to blog posts. This functionality makes it easy to manage leftover data, miscellaneous notes and other communication by keeping everything together with its corresponding post. Consolidating information like this helps to streamline flow and organization into the future.
WordPress provides several navigational template tags to make it easy for visitors to surf your pages. There are basically two different types of template tags used for chronological post navigation:
A useful tool to have in in your WordPress toolbelt is the ability to quickly and easily search for, find, and replace specific strings of text directly from the MySQL database. We can do this by entering SQL queries either directly or through one of those handy interface applications like phpMyAdmin, which seems like one of the most prevalent PHP applications on servers today.
You know the "quick action" button in the WordPress admin? It's a darn useful little UI touch. At the Dashboard, the default is "New Post". But depending on where you are in the Admin, the default of it changes. In general it's really helpful. For example when you are in the Plugins area, the default is Install Plugins:
In WordPress, there are three ways to respond to a post: you can leave a comment, leave a trackback, or just link to the post to create a pingback. When displaying all of the responses to your posts, it’s a good idea to separate the comments from the pingbacks and trackbacks. Uninterrupted comment threads are a pleasure to read, as are well-styled lists of pingbacks. This is an excellent way to improve the usability and stylishness of your comment areas.
If you have posts that include the
nofollow attribute on links, you may at some point decide to remove them. By default, WordPress doesn’t insert
nofollow attributes in post content, but there are a variety of plugins that will insert
nofollow into all links in post content.
Or perhaps you have been manually adding
nofollow tags to your post links for SEO purposes. Regardless of how they got there, it’s very easy to clean things up and remove all
nofollow attributes from post content.
The default output for WordPress’
post_class template tag includes class names for just about every type of page view imaginable:
Everyone who has been using WordPress for any length of time should be familiar with the good ol’
--> tag. When you are writing a post, inserting the
--> 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 on single-post views. Let's look at a quick example..
Let’s say your blog is set to display ten posts per page, as specified via the WordPress Admin under Settings ▸ Reading. Once set, ten posts will appear on your home page, archive pages, search results, and so on. In other words, if it isn’t a single-view page or an actual “page” page, you’re gonna get ten posts per page. It’s a global setting.
But what if you want to display different numbers of posts for different types of page views? For example, instead of showing just ten posts on your search-results pages, you may want to show a whole bunch, like maybe fifty or something. Perhaps you would also like to limit the number of posts displayed on your category archives to only five.
Typically when you use one of WordPress functions to output a list of "stuff" from WordPress, you can pass a parameter to eliminate the "title" that WordPress likes to put in there by default. For example, with
wp_list_categories you pass along "title_li=" with nothing after the equals sign to remove the title that normally accompanies the output. With the function to output links (e.g. blogroll), you use the function wp_list_bookmarks, but unfortunately using that same parameter the same way is ineffective at removing the title.
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 an RSS feed for the comments on every published post. Many sites take advantage of this by displaying a feed link next to the comments area. This enables visitors to subscribe to the comment thread and stay current with conversation. It's convenient, simple, and super useful. For example, a typical feed menu for many blogs includes the following items:
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.