【发布时间】:2015-11-25 13:46:20
【问题描述】:
我有显示 PHP 帖子的基本循环
if (have_posts()) :
while (have_posts()) : the_post(); ?>
<div class="post">
<h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
<div class="post-info"><?php echo get_the_date(); ?> - posted by <?php echo get_the_author(); ?> </a></div>
<?php the_content('<button class="show-more">Saznajte više</button>'); ?>
</div>
<?php
endwhile;
else :
echo "<p>No posts</p>";
endif;
这是具有<div class="post-info... 的行
现在它工作得很好,它在帖子标题下显示日期和作者,但它也显示创建新页面的时间。我了解 Wordpress 就像博客一样工作,它很自然地将新页面视为帖子,但是我想避免这种行为。我只希望它显示在帖子标题下,而不是新页面标题下。你会建议我什么?
【问题讨论】:
-
这是主题模板吗?文件名是什么?
-
这是我从头开始编写的自定义主题。它是 index.php 文件。它没有父或子主题。这是一个非常基本的主题,只有 index.php、functions.php、footer.php 和 header.php 文件。
标签: wordpress