【发布时间】:2018-01-10 22:14:33
【问题描述】:
我为特定类别创建了帖子模板,其中包含缩略图、标题、摘录,我在模板中添加了带有自定义内容的附加 div,这些内容将自动生成,设为 div class= "custom"。我还在博客页面上创建了一个循环,显示该特定类别的所有帖子。我知道如何显示缩略图、标题、摘录,但不知道如何显示 .custom。我应该如何创建这个循环?谢谢
<?php
if ( have_posts() ) :
query_posts('cat=1');
while (have_posts()) : the_post();
?>
<div class = "programs-flex-item">
<div class = "programs-flex-item__title"><?php the_title(); ?></div>
<div class = "programs-flex-item__image"><?php the_post_thumbnail(); ?></div>
<div class = "programs-flex-item__excerpt"><?php the_excerpt(); ?></div>
<div class = "custom">HERE IS CUSTOM CONTENT!!!</div>
</div>
<?php
endwhile;
endif;
wp_reset_query();
?>
【问题讨论】:
-
这里的
CUSTOM CONTENT是什么意思?你想在那里添加CUSTOM CONTENT吗? -
@AlivetoDie 它将是在帖子模板上使用 js 生成的随机 html 内容(例如,single.php)