2014-05-15 91 views
0

我已經將Bootstrap 3整合到Wordpress中,但現在我有點困惑。我用文件index.php,header.php,footer.php,functions.php & single.php創建了一個新的主題。我也拉了一個菜單,允許我自定義,我想調用我的functions.php文件中包含的navwalker.php。Wordpress&Bootstrap

一切正常,所以我的帖子顯示在索引頁面等,但他們也顯示在每一個頁面 - 我通過WordPress的管理創建的其他頁面顯示菜單,我可以點擊它們,但內容上index.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(); ?> 

回答

0

好吧我想我已經想通了 - 在我的菜單選項中,我有能力使用URL直接鏈接到我的自定義頁面。我會這樣做。

我必須包括一個位PHP的進入頁面:

<?php 
/* 
* Template Name: Contact Page 
* Description: A Page Template with a darker design. 
*/ 

// Code to display Page goes here... 

?> 

而且從Wp的Admin屏幕的頁面,我不得不分配的下拉該頁面模板上爲我工作的罰款!