I was having some problems with the display of post excerpts on category archive pages. WordPress (2.3.1) was stripping out HTML tags, including links and scripts. This led to at least two problems.
First, short posts, where my only intention is to post a link with a little note, are completely visible in the excerpt view, yet they didn’t include the link. The end result is that these posts look like mistakes. Second, my Library and Wishlist categories looked equally silly and broken without the scripts that pull in information from Amazon.
A bit of poking around led me to a post on Improving WordPress’ the_excerpt() template tag. I followed the instructions in the “Finding the excerpt function” section to locate the code I needed to modify, and then made a few changes of my own.
Rather than increasing the word count of the excerpt and adding a tag or two to the list of HTML allowed in the excerpt, I ignored the word count, and commented out the strip_tags() function completely. (I also ignored the instructions about removing unwanted javascript code. Not only was I not having problems with javascript, I figured I should keep it for the sake of embedding information from Amzaon, Google, and the like.)
This left me with an excerpt that can include any HTML and javascript I want, and solved both my problems.


1 response so far ↓
I’m glad my post helped point you in the right direction :) – thanks for the link back.