开发者

wordpress <!--more--> not rendering a link

开发者 https://www.devze.com 2023-04-03 01:56 出处:网络
I am using the <!--more--> tag in my wordpress copy to create an excerpt from the main content and also echo a link, however it 开发者_运维问答is totally disregarding this tag and just posting t

I am using the <!--more--> tag in my wordpress copy to create an excerpt from the main content and also echo a link, however it 开发者_运维问答is totally disregarding this tag and just posting the full article, below is hope I am implementing it in my templates,

<?php the_content("Read more about this article..."); ?> am I doing something wrong? Currently it is showing the while post when I use the above code, however it is my belief that it should only only show everything above the <!--more--> tag?


As per the official WordPress support site:

From the use of your PHP code, it looks like you want to use the more tag on pages. More works with blog posts but not pages. Please add the following code to your document above your PHP line you provided to make it work:

<?php
global $more;
$more = 0;
?>

Also, be sure that you are not simply in preview mode and that you have actually published the article and previewed it:

[T]he more tag is not displayed in post previews, since previews display posts in entirety, but the more tag will appear once the post has been published.


Perhaps you are using custom page template to display archives. "More" tag doesn't work in pages. If you want to turn it on in Pages...


<?php the_content("Read more about this article..."); ?>

you should use the code like this if you wanna show the to work in a page

<?php
global $more; 
$more = 0;
the_content("Read more about this article..."); 
?>
0

精彩评论

暂无评论...
验证码 换一张
取 消