vyt*_*fla 1 php wordpress blogs
我正在尝试将我的帖子张贴在另一个页面(博客)上,并将“主页”页面显示为首页。这两个页面都分配有自己的模板(首页用于首页,博客用于博客)。
在阅读设置中,我将首页设置为主页,将帖子页面设置为博客。但是,当我转到url.com/blog时,它显示的模板与我的主页相同。我不确定为什么它不会显示我的两个博客文章。
在我的home.php模板中,我有以下代码,这可能是问题吗?
<!-- Display featured images -->
<?php
$args = array('post_type'=> 'page');
query_posts( $args );
?>
<!-- Get featured images -->
<div class="main-thumb left">
<?php
if ( have_posts() ) {
while ( have_posts() ) {
the_post();
?>
<li>
<a href="<?php echo get_permalink(); ?>">
<div class="tint">
<div class="overlay caps">
<?php
echo(types_render_field("top-overlay", array("output"=>"html")));
?>
<?php
echo(types_render_field("bottom-overlay", array("output"=>"html")));
?>
</div> <!-- end .OVERLAY-->
<?php the_post_thumbnail(); ?>
</div> <!-- end .TINT-->
</a>
</li>
<?php
}
}
?>
</div> <!-- end .MAIN-THUMB-->
Run Code Online (Sandbox Code Playgroud)
根据模板层次结构,home.php将用作主页:
WordPress首先确定其是否具有静态首页。如果设置了静态首页,则WordPress将根据页面模板层次结构加载该页面。
如果尚未设置静态首页,则WordPress将查找名为home.php的模板文件,并使用它来生成请求的页面。
| 归档时间: |
|
| 查看次数: |
750 次 |
| 最近记录: |