Per the wordpress codex, I was able to remove the “Read More” link on my home page’s post list by using
<?php the_content('',TRUE,''); ?>
Most of our posts link to external articles and thus are maybe only a sentence or two (no need to Read More as it were). If, however, we do write a longer post, I may want that “Read More” to appear. I can choose what is in the excerpt and the rest of the content by using <!--more-->
when writing a post. To get a custom “Read More” link, I add
<?php the_content('Read More',TRUE,''); ?>
But when I do this, “Read More” always appears. Is there a way to selectively show this only if there is content below a <!--more-->
comment in the post?
You can use get_extended() . It returns an array with two keys
main
andextended
. You can check whether theextended
key contains anything and display the “read more” link if it does.Note that you must pass the post’s content as an argument when calling the function.