Conditional "Read more" link in Wordpress?
June 4, 2009 1:06 PM Subscribe
PHPfilter: Help me do something with Wordpress that should be very simple, if only I knew how.
You know the little "Read more" or "More inside" link at the end of a post on the front page, that takes you to the ... more inside? How can I set up my Wordpress template so that that link only appears if there is in fact more inside? My posts often are just one or two paragraphs, 100% of which is on the front page, with no jump. In those cases, I don't want the link to appear at all.
You know the little "Read more" or "More inside" link at the end of a post on the front page, that takes you to the ... more inside? How can I set up my Wordpress template so that that link only appears if there is in fact more inside? My posts often are just one or two paragraphs, 100% of which is on the front page, with no jump. In those cases, I don't want the link to appear at all.
Response by poster: Sure, the pertinent bit is here. I don't recall doing any hacking on this part, but it's been a while, so my memory may be tricking me.
posted by jbickers at 1:52 PM on June 4, 2009
posted by jbickers at 1:52 PM on June 4, 2009
Clearly, somebody has hard-coded in "read the entire article" as the text for what would ordinarily just be the permalink. You could replace that text with whatever you want (the date and time would be typical link text), or delete it, since the post title is also serving as the permalink.
posted by adamrice at 2:07 PM on June 4, 2009
posted by adamrice at 2:07 PM on June 4, 2009
Response by poster: Yes, the post title is the permalink, but is there a way to get that "read more" link to appear when appropriate, in addition to having the title as permalink?
posted by jbickers at 2:09 PM on June 4, 2009
posted by jbickers at 2:09 PM on June 4, 2009
Alt-Shift-T inserts the 'read more' tag at whatever place you think is appropriate as you're creating your post.
Is that what you mean, or am I missing something?
posted by DandyRandy at 2:33 PM on June 4, 2009
Is that what you mean, or am I missing something?
posted by DandyRandy at 2:33 PM on June 4, 2009
The "read more" link is inserted automagically when you insert a break in your post. You don't need to do anything special with your template to make that happen. In fact, if you do insert a break, you should be seeing two different "read more" links—the one that is inserted on the fly, and the one that is hard-coded into your template.
You create a break by typing <!-- more --> or by clicking the "more" button that appears above the main composing box.
posted by adamrice at 2:38 PM on June 4, 2009
You create a break by typing <!-- more --> or by clicking the "more" button that appears above the main composing box.
posted by adamrice at 2:38 PM on June 4, 2009
Response by poster: The "read more" link is inserted automagically when you insert a break in your post.
You create a break by typing <> or by clicking the "more" button that appears above the main composing box.>
Yeah, that's not happening. I took out that hard-coded bit and went back and inserted a break - and everything after the break vanishes off the front page. No jump link.
If it helps, we're running this theme. Any idea where I might look for where the pertinent hackination took place?
posted by jbickers at 5:15 AM on June 5, 2009
You create a break by typing <> or by clicking the "more" button that appears above the main composing box.>
Yeah, that's not happening. I took out that hard-coded bit and went back and inserted a break - and everything after the break vanishes off the front page. No jump link.
If it helps, we're running this theme. Any idea where I might look for where the pertinent hackination took place?
posted by jbickers at 5:15 AM on June 5, 2009
Best answer: Read about the the_content tag. The "read more" text is passed as an argument to that tag, eg,
<?php the_content('Read more...'); ?>
posted by adamrice at 6:25 AM on June 5, 2009
<?php the_content('Read more...'); ?>
posted by adamrice at 6:25 AM on June 5, 2009
« Older What are your favorite toys for the lake or pool... | How do I create an online poll which users can... Newer »
This thread is closed to new comments.
posted by adamrice at 1:33 PM on June 4, 2009