WP – Enable read more links for pages

When listing pages using the_loop(), the latest version of WordPress (2.8.4) does not allow for a “Read more…” link to be appended to a list of pages using the_content() along with the <!–more–> quicktag.

Although it wasn’t immediately obvious to me, read more links can be enabled by over-riding the global $more variable and setting it to false, before looping through the result set, for example:

global $more; $more = FALSE;
query_posts('post_type=page');
if ( have_posts() ) : while ( have_posts() ) : the_post();
	the_content('Read More...');
endwhile; endif;

I couldn’t actually discover why this is not the default behaviour when querying pages. There may be a good reason behind it, but in my experience I found it mildly irritating.

4 Replies to “WP – Enable read more links for pages”

  1. It was not possible to use the_excerpt in the situation I was in.

    By default, the excerpt is limited to a length of 55 words. Although this can be adjusted by adding a excerpt_length filter, I didn’t want the content to be cut off half way through a paragraph.

    On a more important note, using the_excerpt on pages causes it to generate an automated teaser as there is no excerpt field like that in posts. This means that HTML tags and graphics are stripped from the excerpt’s content.

    For me, it was important that formatting be preserved when displaying the content.

    Like

  2. Thanks, took me 30 minutes now :/ since the backend editor allows generally to insert the read_more break, I wonder why this option is not activated by default… thx for the hint;

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: