Warning: High Geek Quotient, Proceed With Caution.
Here’s a couple of tips to fix some Wordpress issues that the Wordpress development team says are Working As Intend. This post is not for non-techies.
First we have A Wordpress Hack To Use The More Tag And Still Show Full Posts In Your RSS Feeds.
Dave recently rolled out his latest redesign on his Search Engine Marketing Blog. Cormac and I noticed he wasn’t displaying full feeds in the RSS feed any more.
This is because the Wordpress developers believe that if you use the <!– more –> to show partial posts on your blog homepage, obviously you want to show partial posts on your RSS feed. This is a Bad Thing and will royally piss off your RSS subscribers, particularly those reading feeds on handheld devices.
So what to do about it? Well, you can grab a plugin to fix this here. Or, you can delve into wp-includes/post-template.php in your Wordpress directory :-)
Here’s the code you’re looking for. Replace
if ( preg_match('/<!--more(.+?)?-->/', $content, $matches) ) {
with
if ( !is_feed() && preg_match('/<!--more(.+?)?-->/', $content, $matches) ) {
This fix simple prevents the reg match running if it’s a feed.
You can make this simple change every time you upgrade Wordpress and you won’t need to install any plugins etc. Ok, I promised you another fix.
This one is A Wordpress Hack To Stop The More Tag Breaking Your Digg Button.
Yeah, that pesky <!– more –> tag again! Leo over at ZenHabits (another really great site) had a problem where the more tag was breaking the Digg button because it was inserting #more-$id on the end of his permalinks. Y’know, I’ve always disliked how the Read More link isn’t to the top of the page, so let’s just get rid of that anchor completely…
This is again in the wp-includes/post-template.php in your Wordpress directory. Replace this line:
$output .= ' <a href="'. get_permalink() . "#more-$id\" class=\"more-link\">$more_link_text</a>";
with
$output .= ' <a href="'. get_permalink() . "\" class=\"more-link\">$more_link_text</a>";
Ok, that’s all for now. Please leave a comment with feedback, particularly if you found it useful. Cheers :-)









{ 3 comments… read them below or add one }
Hey Al,
We finally got it working. We had the added complication of limiting the amount of text on the main blog page as well as not showing images on the main blog page.
We used a different method to what you posted.
IM me if you want details on how it was done.
Thanks again for all your help.
Thanks for the tips man
Wow, these tips are great! Thanks!