【发布时间】:2017-07-27 01:48:20
【问题描述】:
我需要在我的 wordpress 模板中自定义 single.php 模板。 在我的 single.php 中有这一行
我的新模板需要显示帖子图片、帖子日期、帖子文本。
我该怎么做?
谢谢
【问题讨论】:
-
你必须学习 php 或使用一个为你做这件事的插件。谷歌周围。 wpbeginner.com/wp-themes/…
我需要在我的 wordpress 模板中自定义 single.php 模板。 在我的 single.php 中有这一行
我的新模板需要显示帖子图片、帖子日期、帖子文本。
我该怎么做?
谢谢
【问题讨论】:
Google 可以很容易地告诉您这是如何完成的,但因为我在这里,所以我会提供帮助。
首先,学习WordPress Loop。
打开您的 single.php 模板并粘贴以下内容:
<?php
if ( have_posts() ) {
while ( have_posts() ) {
the_post();
// Post Image
the_post_thumbnail();
// Post Date
the_date();
// The Post Content
the_content();
} // end while
} // end if
?>
然后阅读使用的功能:
【讨论】: