This guest post was written by Leland of Theme Lab, where he has released over 50 WordPress themes. In addition to themes, Theme Lab also provides some WordPress guides. If you have WordPress knowledge and are interested in writing a post for Hack WordPress, please contact us.
Sometimes you may not want your search results to be limited by the confines of the standard WordPress Loop. This is a quick code hack to allow a search to return unlimited results, altering the standard WordPress Loop by using a custom query. You can do this in a few different ways. If you have a search template, in search.php you can simple add the following line of code above your Loop.
Find:
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
Add:
<?php $posts=query_posts($query_string . '&posts_per_page=-1'); ?>
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
Make sure you put this code in your search.php only, unless you want unlimited posts on your index or archive pages. The -1 you see can be changed to any positive integer to limit the posts to a number you choose as well.
If you don’t have a search.php in your theme, the next level down in the Template Hierarchy is your Main Index Template, or index.php. You can use a conditional tag for the same effect.
For this we’ll use the same code as above, except wrap it in the is_search() conditional tag, like so:
<?php if (is_search()) { $posts=query_posts($query_string . '&posts_per_page=-1'); } ?>
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
You can use this technique to change the standard Loop limitations of archives, categories, tag pages, and even your main index template - but it would probably be easier to simply change your reading settings for that.
If you are a WordPress designer, are you using conditional tags in your themes? For those unfamiliar with them, conditional tags are snippets of PHP code you can easily use to set up conditions where the code is used. The most common use for these would be for your sidebar or your pre/post meta sections of your posts where you display your post details. With conditional tags, you can display certain functions only on pages of your choice. A couple of months ago we talked a little bit about WordPress conditional tags on this site and when to use them, but we didn’t get into a great amount of detail.
Leland over at Theme Lab has been working on some great WordPress guides lately, and one of his recent posts that caught my attention is the Ultimate Guide to WordPress Conditional Tags. This post provides a more thorough explanation of conditional tags and how to use them. If you’ve been wanting to improve your coding, this would be a great post to check out.
A few days ago, I ran across another great free WordPress theme over at Daily Blog Tips. If you don’t want to purchase a theme, I would definitely pick out some of the themes they’ve been releasing recently. This particular theme is called PassionDuo, and it has a lot of the quality that I look for in a free WordPress theme.
Here are the features the author lists that are associated with PassionDuo:
- Advertising ready: The theme comes with a 468×60 banner spot on the header, and 6 125×125 spots on top of the sidebar. It should also be easy to integrate ad units of other sizes throughout the theme.
- Feedburner Integration: The theme has an options page where you can simply paste your Feedburner feed URL. It also comes with a styled email subscription form, where you just need to put your Feedburner email id.
- Comments Styling: The author comments already come with a different style so that readers can easily identify them.
- Search Engine Optimization: As usual the title and meta tags have already been optimized. The categories and archive pages are also structured to display only post excerpts.
In addition to these great features, you will also get the choice of either green, red, or blue. Here is a screen shot of the green version:
If you’re interested, here is the demo and download information:
I will be adding this theme to the appropriate WordPress theme galleries.
Sometimes it is fun to look back, and today I want to take a quick look back at the early stages of blogging, and examine the relevance of a term that many of you are probably familiar with…trackbacks. Flash back six years ago when blogging was a very new idea and had yet to develop into what we have today.
Before comments really caught on, it was common for a blog post’s conversation to spill over to several blogs, because bloggers would post their “comment” on their own weblog and give their takes. The problem was, this often made it difficult for a reader to follow conversations. As a result, the trackback was invented by the team over at Six Apart for their Movable Type software (and eventually Typepad, etc.). Eventually, other blogging software (include WordPress) adopted this method so readers could see a post, then see who was talking about it.
In the years since then, pingbacks were created to be easier to send are less vulnerable to spam. People that don’t have a blog will usually leave comments. To me, this begs the question…do we really need trackbacks any longer? When was the last time you received one that wasn’t spam? In my opinion, blogging has outgrown the trackback and the pingback has made it irrelevant.
As for the pingback, I think it is great for now. I do think, however, that we are headed towards blogs using something like a Google Blog Search or Technorati to display on each individual blog page a ”who is talking about this post” module, which would make the pingback fairly irrelevant as well. All it would take is for Google to put a little more focus in improving their Google Blog Search or Technorati to narrow their focus in this type of area so that page load times wouldn’t take a drastic hit.
Anyway, sorry for the ramble, but I figured I would throw it out there and get your thoughts on trackbacks and where blogging is headed in the future.









