【发布时间】:2015-09-09 16:45:30
【问题描述】:
我已将 Bootstrap 3 集成到 Wordpress 中,但现在我有点困惑。我用 index.php、header.php、footer.php、functions.php 和 single.php 文件创建了一个新主题。我还引入了一个菜单,该菜单允许我自定义我想要调用的 navwalker.php,它包含在我的 functions.php 文件中。
一切正常,所以我的帖子显示在索引页面等上,但它们也显示在每个页面上 - 我通过 Wordpress 管理员创建的其他页面显示菜单,我可以点击它们,但索引上的内容.php 显示在每个页面上 - 我如何只在主页上显示它而不显示其他内容?
这是来自我的索引页面的代码。
<?php get_header(); ?>
<div class="jumbotron">
<div class="container">
<center><h1>site name</h1></center>
<br />
<center><h4>Lorem ipsum</h4></center>
</div>
</div>
<div class="container" style="background-color: rgba(255,255,255,0.3); padding-top:20px; color: #FFF;">
<div class="page-header" style="border-bottom: none;">
<center><h3>FROM THE BLOG</h3></center>
</div>
</div>
<div class="container" style="background-color: rgba(255,255,255,1.0); padding-top: 1px; border-top: 3px solid #f6c52d; padding-top: 20px; margin-bottom: 20px;">
<div class="row">
<div class="col-md-8">
<div class="panel panel-default" style="border: none;">
<div class="panel-body">
<div class="page-header">
<h3>Latest news</h3>
</div>
<?php query_posts('posts_per_page=3'); while(have_posts()) : the_post(); ?>
<?php the_post_thumbnail( 'medium' ); ?>
<h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
<p><?php the_excerpt(); ?></p>
<p class="text-muted">Posted by <?php the_author(); ?> on <?php the_time('F jS, Y'); ?></p>
<?php endwhile; wp_reset_query(); ?>
</div>
</div>
</div>
<div class="col-md-4">
<div class="panel panel-default"style="border: none;">
<div class="panel-body">
<div class="page-header">
<h3>Weather info</h3>
</div>
<a href="findus.html">
<img src="<?php bloginfo('template_url')?>/img/lake.png" style="width: 100%;"/>
</a>
</div>
</div>
</div>
</div>
</div>
<?php get_footer(); ?>
【问题讨论】:
标签: wordpress twitter-bootstrap-3 blogs