Tech Hive

Blog on Wordpress, Design, Usability, Accessibility and Standards

  • Content
  • Sidebar
  • Footer
  • « The Great IE 6 Hack
  • Redesigned »

Appending the title of the post in Read More links for Wordpress

Leave a response | Trackback |
Tags: tips, WordPress

One of the guidelines in usability is that you should provide only one way that will lead them to a certain action. For example, if someone sees 2 option buttons, chances are that they might think that each option button does separate tasks when in fact their functions are the same. Also, we have to make sure that the links are descriptive enough and if not, then we should provide a title for the link so when a user hovers over it then they’ll know where the link will take them.

On a similar note, accessibility advocates encourages people to use unique name for every link that we use on a page (kinda like what I was saying before only have a different reason), meaning countless “Read more of this entry” is not really the best practice because you’re using the same text over and over and these texts are leading the user to different pages.

I was looking for a way to add that in <?php the_content(); ?> tag in wordpress before but I couldn’t do it. What I did then was append the the_title(); within the_content(); so it looked like this –

<?php the_content('Read more of ' . the_title() . ' & raquo;' ?>

The problem though is that it does echo the “Read more of” but the title is no where in sight! I was so ready to find a way to make it show by hacking away through function.php, thankfully I remembered to check the_content page in the codex first.

What I should’ve done in the first place is to add parameters to the the_title() tag so it will show like this –

<?php the_content('Read more of ' . the_title('', '', false)) ?>

This follows the same parameter as the the_title(); template tag.

Parameters

before
(string) Text to place before the title. Defaults to ”.

after
(string) Text to place after the title. Defaults to ”.

display
(Boolean) Display the title (TRUE) or return it for use in PHP (FALSE). Defaults to TRUE.

So you may use it like this:

<?php the_content('Read more of ' . the_title('&ldquo ;', '&rdquo ; &raquo ;', false)) ?>

So it will echo as Read more of “Title of the Post” ».

8 Responses to “Appending the title of the post in Read More links for Wordpress”

  1. Jeric Peña May 9, 2008 at 11:44 pm

    Thanks for the tip! I’ll use this on my blog besides, I don’t want to rank high on SERPS when searched the keyword “read more…”

  2. Mae May 10, 2008 at 3:00 am

    hehe thanks Jeric! Glad I was of any help to you :)

  3. Chris Osborne July 20, 2008 at 6:35 am

    I had this working before, but lost it when I switched themes. Thanks for having this in such an easy to follow format. I’ve never liked having what looked like the same link going to different places.

  4. dani January 30, 2009 at 9:04 pm

    finally I found it here..I’ve lost my notes
    It’s really useful in SEO, I guess

    but now I see that you are using ‘read the rest of [title]‘
    any reason please..

  5. Mae January 31, 2009 at 2:01 am

    for usability reason, so I won’t have a bunch of “Read more” links

  6. dani January 31, 2009 at 6:07 am

    Mae,
    sorry I was wrong that previously chyntiasays and atrc (WCAG 2 L2) has a diffferent result for your homepage test (Clearly identify the target of each link)
    the problem maybe in the form code, not the ‘read more style’
    thanks

  7. Mae January 31, 2009 at 10:56 am

    I’m sorry, can you be more specific? What were you trying to do?

  8. dani January 31, 2009 at 12:08 pm

    I tried to check the accessibility of your homepage using those 2 tools, due to ‘read more’ styling
    no problem with the ‘read more’ style :)

    atrc is still in experimental, they found 1-2 errors in the form of this website (home and this web pages)

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Pages

  • About the Author
  • Archives
  • Contact
  • Site Map
  • best 10 web hosting

Post a job. Find one. authenticjobs.com
Come in, we're hiring

Full-time and freelance job opportunities available at Authentic Jobs:

Post a job and reach web professionals everywhere.

Archives

  • May 2009
  • March 2009
  • November 2008
  • September 2008
  • August 2008
  • July 2008
  • June 2008
  • May 2008
  • April 2008
  • March 2008
  • December 2007
  • November 2007
  • October 2007
  • September 2007
  • July 2007
  • June 2007
  • May 2007
  • April 2007

Categories

  • Accessibility
  • CSS Tips
  • Gmail
  • HTML
  • Online Finds
  • Online Tools
  • Review
  • Tutorial
  • Updates
  • Usability
  • WordPress
  • Wordpress Themes
Sign up for PayPal and start accepting credit card payments instantly.

Tech Hive is proudly powered by WordPress
Spartan by Mae Paulino, a Filipina Web Designer