Make Wordpress More Links Accessible

by Neerav Bhatt on October 2, 2004 · 5 comments in Topic: Webdev & SEO

While the wordpress blogging package does an admirable job publishing valid XHTML/CSS with good semantic code there is one feature which fails accessibility guidlelines.

This is the (more�) feature, which allows the bloggers to display the first part of a long post and then link to the whole post at the bottom with an automated link eg:

(more�)

If the more feature is used several times in a page eg: on a blog homepage than most of the links on the page will have the link text (more�) which is not very accessible.

While wordpress does allow users to customize the more tag, all this does is replace (more�) with another few words which will be used repeatedly instead eg: (read more�)

The solution to make the link more accessible therefore has 2 parts:

  1. Follow the instructions in the first paragraph of customize the �more� tag to change (more�) to (read more�)
    • Open template-functions-post.php from your blogs wp-includes folder.
    • Replace the line (around line 128ish):

      $output .= ' <a href="'. get_permalink() . "#more-$id">$more_link_text</a>";

      With these 2 lines instead:

      $title = get_the_title();
      $output .= ' <a href="'.get_permalink(). "#more-$id">$more_link_text $title</a>";

  2. Upload the changed index.php and template-functions-post.php to the appropriate directories on your web server

So now when you use the more feature, wordpress will use the title of your post to automatically generate a much more accessible link than (more�) eg: read more about Make- Wordpress More links accessible

5 comments





{ 5 comments… read them below or add one }

1 Derek Featherstone October 2, 2004 at 10:41 pm

Hi Neerav,
Good to see others finding solutions to this problem as well…

The function WP uses to display an article’s content is: the_content(). If you check out its functionality, you can accomplish the same thing. In my index.php I use:

the_content("Continue reading " . the_title('','',false), 0);

I had started down the same path as you, then found that the_content() function did what I wanted to, so I backed out my changes… I think the only disadvantage of modifying template-post-functions.php is that when you upgrade your WP installation it will be a bit more of a hassle to manage all the manual changes that have been made…

2 Neerav October 3, 2004 at 1:16 pm

thanks Derek

Your “Featherstone” method is better than mine as it only requires editting one file, not two, and is confirmed in the Wordpress Docs. I have implemented it instead of my hack.

3 Hank October 4, 2004 at 6:57 pm

Thanks for the tips guys, that’s really helpful.

4 Todd March 23, 2005 at 10:31 am

I just came upon this as I was updating my WP 1.5 install. To further aid in this implementation, here’s something else. If you modify “the_content” on your index.php page, you can change the words used in the “more” link *and* you can add something before and after the title of the linked entry:
the_content("Continue reading " . the_title('','',false), 0);
Those two instances of ” in the parentheses allow for what you want before the title and what you want after the title of the page. I wanted quotation marks around and bold lettering of the title of the entry in my “more” link. Here’s all I did:

the_content("Read more of " . the_title('"','"',false), 0);

Also, I wanted that link to go to just the page for the article, not bookmarked down the page to wherever I put in the “more” quicktag. Editing template-post-fucntions.php, I replaced this:
$output .= ' $more_link_text";
with this:

$output .= ' $more_link_text";

Opening up template-post-functions.php and searching for “#” will get you to that line.

5 Phil Thompson August 31, 2006 at 6:43 pm

This is exactly what I’ve been looking for. Thanks.

Leave a Comment

Additional comments powered by BackType

Previous post: Web Essentials 2004 – Day 1 Summary

Next post: John Safran Vs God SBS-TV 2004 (Review)