Tag Archives: wordpress mod

How to Add RSS Feed Link to archive.php for WordPress

archive.php (in the WordPress theme folder) is the file that handles the output of posts grouped by categories, tags (in WP 2.3) and by dates. Since I have a wide variety of topics, I figured it would be helpful to provide feeds specific to a reader’s particular interest(s). The problem was I didn’t know how to do it easily. After playing around with the code, I came up with a solution which turned out to be pretty simple and straightforward. It is probably not perfect but it gets the job done.

Wherever you want to place the link, add this code:

<a href="feed/">Subscribe to Feed</a>

So, if you’re interested in my WordPress postings, you can use the link to the feed when viewing the WordPress category.

How to Display All Blog Posts

For reasons I will explain in another post about Linked Custom Search Engines, I wanted to generate a page that would include all of my posts in their entirety. There didn’t seem to be a ready-made solution. I found a plugin but it didn’t show all posts the way I wanted. This is different from the current view where the posts are paginated when there are x number of posts per page.

I came across this support page, displaying postbypost yearly archives, where it game me a good starting point. I learned about The_Loop. I eventually managed to create a page that shows all posts on one page.

I figured I would share the code to help others in a similar situation. All Posts Template file, is a template file to put in the themes folder. Remove the .txt that I had to add to the filename to upload to my blog. Create a new page and choose AllPosts as the template. If you want to minimize duplicate content, add a robots.txt entry for that page. It’s possible to add url parameters so that posts from specific years are displayed: 2007 posts.

How to Minimize Duplicate Content in WordPress Blog

After reading this post at Google’s Webmaster Group, I was inspired to find out how to stop displaying full content on pages where posts were listed in categories, archives, etc. I am not so concerned about duplicate content as much as I don’t like for people to find a result in a category page but they have to look around the page to find it, or the post got moved to another page in the category and thus can’t find what they were looking for.

I didn’t know how to go about doing it so I searched. This page, Showing full posts on homepage, but snippets elsewhere, was a good start.

In short, the key is to edit the theme’s archive.php:


<?php the_content(); ?>


<?php the_excerpt() ?>

A while back, I had copied the archive.php from the Default theme for another purpose, because Ocadia didn’t have its own version of the file. I ended up not using the file for anything important so I didn’t modify it much. Once I edited it to show snippets, or excerpts, on category and archive pages I noticed that it didn’t look like the homepage listings. For consistency, I copied the code between the divs for <div class="post"> in the theme’s index.php. With that change, pages for categories and archives no longer showed the posts in their entirety.

However, posts that were listed on “previous pages”, such as the one linked to at the bottom of the home page, continued to be a source of duplicate content. In the ocadia index.php, the code for search page is written to show excerpts. What I did was add a condition so that pages showed excerpts, too, like this:

<?php if (is_search() || is_paged()) { ?>

<?php the_excerpt() ?>

Now, if you go to the deeper pages of the index, category, etc, it shows post excerpts.

I also read recommendations to do the same to the home page. When I made the change to the home page, I did not find it aesthetically pleasing. The excerpted posts on the home page of the blog made it look like a splog that had scraped the content–not a good first impression for visitors. This was a situation where user experience trumped search engine optimization.

I just made these changes tonight. Time will tell if this will help or not.

Added Image Scroller Based on iTunes

rphMedia over at the Coppermine forums has offered a mod called Image Scroller – based on iTunes. It looks so cool that I couldn’t help but implementing it at my Take Thu gallery and my blog (at the bottom of the blog’s homepage).

For those who want an includable version of flow.htm, create a file in the include folder called flow.inc.php:
Continue reading

Using Search Everywhere Plugin to Search Jerome Keyword Tags

I installed the Search Everywhere Plugin in the hopes of enabling WordPress search to find posts that have been tagged with Jerome Keywords Plugin. Alas, it didn’t have that capability built-in, nor could I find an available solution, so I tweaked the Search Everywhere code to search tags for results. I based the code modifications on the meta search function. There were four places where I edited the code. Since I’m currently too lazy to provide the instructions, I’ll provide the file as an attachment.

To test that my code works, here’s a search where the query does not appear anywhere else but the tag. It points to this post, but I didn’t want to apply it to an unrelated post since it could cause confusion. You can also confirm that the query does not show up anywhere in this post. Also, to really confirm that the query worked due to the tag and not because of it showing in the url of a post, I tested it on another post. I removed the tag on that other post to avoid confusion.

WordPress doesn’t allow uploading .php files so I had to append .txt to the filename. Just remove .txt, rename it so that it ends in .php, and install the plugin as usual.

Download file: Search Everywhere Plugin