Showing Content in WordPress
Some folks show the full contents of their articles on their main page. Others prefer to show just a short excerpt of the contents. Immaterial of your preferred method of doing things, WordPress offers you a few options.
To show the full content you will need a the_content() tag in the appropriate place in your template. This on its own will show the full content for your articles. Should you prefer the shorter version the the_content() tag will have to be replaced with the_excerpt().
If you use the the_excerpt() tag WordPress will show only the text you have entered into the Excerpt panel when you wrote your article. If you entered nothing in this panel WordPress will show the first 55 words of your article. Users will then have to click on the Title of the article to view the full contents.
Most people who do prefer excerpts for their articles do however not use the excerpt tag in their templates, they still use the content tag but then they insert a more quicktag at the place they want their excerpt to end.
This is a handy quick way that I also prefer. Doing things this way means you can decide to show an article as an excerpt by simply adding the more, or you can leave another article its full length by simply leaving the more out. You then have this option without having to change anything in your template.
Unfortunately, from an accessibility point of view, this is also the place where you can experience problems.
If you include the more quicktag on a few of your articles that are all on the same page you will end up with a few more links, all using the same link text and titles. This contravenes the accessibility standards. If you want to use the more tags this means you have to change the more tags. Fortunately WordPress makes this easy to do.
According to the WordPress codex the following is the default parameters for the content tag:
the_content(’more_link_text’, strip_teaser, ‘more_file’)
Now what does this mean?
- more_link_text - sets the actual text in the link. You can change this to whatever you want. If you leave it out the word ‘more’ will be shown.
- strip_teaser - this is not a naughty show or something like that. This portion sets whether or not the “more” link should be hidden (TRUE) or displayed (FALSE). The default is FALSE, which shows the link text.
- more_file - sets the link to the file that the “Read More” should link to, if you want it to be different. By default, it links to the current post file.
Remember the content tag is normally only used once within your code. It is however used within the main loop, which means whatever style you set the tag to, the same effect will appear on all your articles on that particular page. We now need to find a way to make the links different for every more link.
My own solution to this problem was actually pretty simple. I coded my content tag in the index.php file as follows:
the_content(”Continue reading ” . get_the_title(”, ”, false))
You might be saying “huh’ at this stage, let me explain:
I ignored the second and third parameters of the content tag. I am happy with the defaults so I simply left them out.
For the first parameter I told WordPress to give the words ‘Continue reading’ followed by the title of the relevant article. The . get_the_title(”, ”, false) portion does exactly this. On this particular article my more text will show as ‘Continue reading Showing Content in WordPress’. Here you can let your creative juices flow and come up with anything you like. The trick is just to ensure that each of your more links will be unique.
There you have it, just another simple way of making your pages as accessible to as many as possible.
These posts might be related:








Hi, my name is Lyndi. Here we talk about all things related to WordPress. You are more than welcome to join in the discussion.


There are currently 107 posts with 952 comments on this blog.
Wordpress is so versatile … I’m too afraid to change because I’m not tech savvy and am scared of losing my posts.
I am afraid I also have no advice for you if you plan to migrate from Blogger. I do not know that platform. I am sure there are many kind people out there who would be willing to help you do this safely should you want to do it.
Hi Sailor,
Nice new layout, although I liked the previous one too!
Eastcoastlife, if you log into Blogger and click on the Help Centre, just type in this: “How can I create expandable post summaries?” and there’s an article explaining how to use excerpts. Hope you find it helpful.
Mikes last blog post..SparkNotes
Thanks Mike. There you go eastcoastlife, hope this helps with your problem.
Thanks for the tips, some of my posts are a bit long but I haven’t got around to finding out how to show excerpts etc. and didn’t know you could change around the_content and the_excerpt. Time to start customising the templates I think…
To excerpt or not. This I suppose is a very personal decision for each blogger. Many users do not like them, others do. Personally I find them okay on the site but not in a reader.
I use the “more tag” which is basically about the same thing as the “excerpt tag”, they both get the job done. Using either of these, does have an advantage over showing full contents. You will actually improve your Alexa rankings, because your visitors will have to click to a second page to read the full post.
Squeakys last blog post..Squeaky’s - Madmouse Blog - EC Suggestion Contest
There are quite a few that will argue this point with you. Personally I tend to agree. Thanks for visiting.