【发布时间】:2020-10-15 10:02:13
【问题描述】:
我正在构建一个自定义的 wordpress 主题。我想在我的首页上发布我的帖子
我在我的 front-page.php 中添加了这个
<?php
if ( have_posts() ) {
// Start the Loop.
while ( have_posts() ) {
the_post();
/*
* Include the Post-Format-specific template for the content.
* If you want to override this in a child theme, then include a file
* called content-___.php (where ___ is the Post Format name) and that will be used instead.
*/
get_template_part( 'template-parts/content', 'archive' );
}
}
?>
content-archive.php
我有这个
<div class="container">
<article class="post">
<div class="post-preview col-10 no-gutter">
<h2><a href="<?php the_permalink();?>"><?php the_title(); ?></a></h2>
<p><?php the_excerpt(); ?></p>
<p class="meta">
<a href="author.html"><?php the_modified_author();?></a> in <a href="category.html"><?php the_category();?></a> <i class="link-spacer"></i> <i class="fa fa-bookmark"></i> 23 minute read
</p>
</div>
<div class=" col-2 no-gutter">
<img src="img/profile-1.jpg" class="user-icon" alt="user-image">
</div>
</article>
当我访问当前主页时,我将主页作为帖子及其截图,然后阅读更多按钮。
我想要拉的是帖子。
【问题讨论】:
标签: wordpress wordpress-theming