2016-06-15 14 views
1

get_template_part();関数を使用して、すべてのカスタムページをフロントページにロードします。私のコードを保存するたびに、ページはすべてフロントページにロードされますが、サイト上で何度も繰り返しコンテンツを繰り返しています。Wordpressのカスタムページ

<div id="primary" class="content-area"> 
    <main id="main" class="site-main" role="main"> 

      <?php while (have_posts()) : the_post(); ?> 
       <?php get_template_part('templates/header'); ?> 
       <?php get_template_part('templates/page-about'); ?> 
       <?php get_template_part('templates/page-services'); ?> 
       <?php get_template_part('templates/page-portfolio'); ?> 
       <?php get_template_part('templates/page-contact'); ?> 
       <?php get_template_part('templates/footer'); ?> 
      <?php endwhile; ?> 

    </main><!-- #main --> 
</div><!-- #primary --> 

私もhttps://github.com/brandonpowell/Test-Wordpress-Site/tree/master/danielschriersite

答えて

1

が倍数の時間にヘッダを呼び出しているgithubのためにそれをアップロードするつもりですが、テンプレートの各

enter image description here

もFrontPageであなたを呼び出すを削除しようとしますテンプレート

WordPressページテンプレートを使用してください

https://developer.wordpress.org/themes/template-files-section/page-template-files/page-templates/

<?php 
/** 
* Template Name: Front Page Template 
* 
* @package WordPress 
* @subpackage Twenty_Fourteen 
* @since Twenty Fourteen 1.0 
*/ 
?> 

<?php while (have_posts()) : the_post(); ?> 
      <?php get_template_part('templates/header'); ?> 
      <?php get_template_part('templates/page-about'); ?> 
      <?php get_template_part('templates/page-services'); ?> 
      <?php get_template_part('templates/page-portfolio'); ?> 
      <?php get_template_part('templates/page-contact'); ?> 
      <?php get_template_part('templates/footer'); ?> 
<?php endwhile; ?> 

、あなたがまたis_front_pageを使用することができます

enter image description here

管理ダッシュボードからページテンプレートのattrを変更バック()関数

<?php if(is_front_page()) { ?> 

     <?php get_template_part('templates/header'); ?> 
     <?php get_template_part('templates/page-about'); ?> 
     <?php get_template_part('templates/page-services'); ?> 
     <?php get_template_part('templates/page-portfolio'); ?> 
     <?php get_template_part('templates/page-contact'); ?> 
     <?php get_template_part('templates/footer'); ?> 

<?php } ?> 
+0

@HermanAndresFigeroaはい私はテンプレートをフロントページに変更しました。ここで何を言おうとしていますか?彼がfron t-pageはすべてのコンテンツを常に読み込んでいない。 https://gyazo.com/b51d13f7ac66cc702d2147925f19b0a7と私はすでに多くのWordpressのリンクを見てきました –

+0

@HermanAndresFigeroaはい彼はWordpressのバックエンドのすべてのテンプレートで呼び出します。あなたはSkypeにbrandonpdesignsを追加しましたので、私はこれを少し良く説明することができます –

+0

何度もthe_content()を繰り返すようなテンプレートとコンテンツが何度も含まれていますか? http://y.imgur.com/NDQbNDx.png –

関連する問題