wordpress静态_修复WordPress静态页面中的Read More标签问题

本文介绍了WordPress在博客中显示摘录的两种方式,重点在于解决使用more标签时在静态页面不工作的问题。提供了一个代码解决方案,用于在页面中启用阅读更多功能,以显示部分帖子。
摘要由CSDN通过智能技术生成

wordpress静态

WordPress has two ways of showing excerpts in a blog. One is by using the_excerpt() tag in your themes, and the other method is by using the more tag. The more tag allows you to specify where the cut off point is in a post while writing a post which makes it easy for the editor and allow you to show teaser content and such. However the more tag is used only on the home page which shows the latest posts. It does not work in Pages. Recently we encountered this issue and thanks to the WordPress forums we found the solution. If you want to turn on the read more tags in pages for showing partial posts, use the following code inside the loop:

WordPress有两种在博客中显示摘录的方式。 一种是在主题中使用the_excerpt()标记 ,另一种方法是使用more标记。 更多标签可让您在撰写帖子时指定帖子中的截止点,这对于编辑器来说很容易,并允许您显示预告片内容等。 但是,更多标签仅在显示最新帖子的主页上使用。 在Pages中不起作用。 最近,我们遇到了这个问题,感谢WordPress论坛,我们找到了解决方案。 如果要打开页面上的阅读更多标签以显示部分帖子,请在循环内使用以下代码:

<?php
global $more;
$more = 0;
?>
//The code must be inserted ahead of the call to the content

<?php the_content('Continue Reading'); ?>

That’s it. If any of you theme designers ever get into this issue, then this should be a quick fix.

而已。 如果您有任何主题设计师曾经遇到过这个问题,那么这应该是一个快速修复。

翻译自: https://www.wpbeginner.com/wp-themes/fixing-the-read-more-tag-problem-in-wordpress-static-pages/

wordpress静态

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值