2016-04-12 16 views
0

私はPHPを初めて使い、Genesisフレームワークを使用して最初のカスタムページテンプレートを作成しました。ページテンプレートがドロップダウンメニューに表示されない

私はメインの親ジェネシスにテーマの子供を作成しました。子供としてアクティブで認識可能で、テーマのダッシュボードにエラーはありません。

問題はまっすぐですが、親ディレクトリにテンプレートを置くと問題はありませんが、新しいページを作成するときにページテンプレート選択のドロップダウンメニューに表示されますが、子テーマのdir、それは今表示されます。

index.phpを子ディレクトリにコピーしようとしましたが、それは親ディレクトリにあるときのみ表示されます。

私はどこでも見てきましたが、WordPressの方法では、親のディレクトリにのみテーマテンプレートを探して子供を除外していると考えています。

喜んでお寄せいただきたい提案があります。

テンプレートのコードがあります:

<?php 
/* 
Template Name: About Template 
*/ 
?> 

<?php get_header(); ?> 

<div id="primary" class="content-area"> 

    <main id="main" class="site-main" role="main"> 

    <?php 
    // Start the loop. 
    while (have_posts()) : the_post(); ?> 


    <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>> 

     <header class="entry-header"> 
      <?php the_title('<h1 class="entry-title">', '</h1>'); ?> 
     </header><!-- .entry-header --> 

     <div class="entry-content"> 


     <?php if (have_rows('about')): 

      while (have_rows('about')): the_row(); ?> 

     <h2><?php the_sub_field('content_area'); ?></h2> 

     </div><!-- .entry-content --> 

    </article><!-- #post-## --> 



    <?php endwhile; // End the loop. ?> 

    </main><!-- .site-main --> 

</div><!-- .content-area --> 

<?php get_footer(); ?> 

答えて

0
<?php 
/** 
* Template Name: Template Nmae 
* 
* @package WordPress 
* @subpackage Twenty_Fourteen 
* @since Twenty Fourteen 1.0 
*/ 

<div id="primary" class="content-area"> 

    <main id="main" class="site-main" role="main"> 

    <?php 
    // Start the loop. 
    while (have_posts()) : the_post(); ?> 


    <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>> 

     <header class="entry-header"> 
      <?php the_title('<h1 class="entry-title">', '</h1>'); ?> 
     </header><!-- .entry-header --> 

     <div class="entry-content"> 


     <?php if (have_rows('about')): 

      while (have_rows('about')): the_row(); ?> 

     <h2><?php the_sub_field('content_area'); ?></h2> 

     </div><!-- .entry-content --> 

    </article><!-- #post-## --> 



    <?php endwhile; // End the loop. ?> 

    </main><!-- .site-main --> 

</div><!-- .content-area --> 

<?php get_footer(); ?> 

がしたいテンプレート名を付け、それをフロントエンドに表示よりも、ページの管理エリアからテンプレート名を選択します。

+0

に取り組んでいるが働くだろう私はテンプレートを親テーマに入れないとできない新しいページのためにページテンプレートを使用しようとしていますが、それは子テーマを通して機能していません。 – Ozzy

+0

コードを共有できますか? –

+0

テンプレートコードを追加 – Ozzy

0

使用このコードには

<?php 
/* 
Template Name:New template name 
*/ 
get_header();?> 
<div id="primary" class="content-area"> 

    <main id="main" class="site-main" role="main"> 

    <?php 
    // Start the loop. 
    while (have_posts()) : the_post(); ?> 


    <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>> 

     <header class="entry-header"> 
      <?php the_title('<h1 class="entry-title">', '</h1>'); ?> 
     </header><!-- .entry-header --> 

     <div class="entry-content"> 


     <?php if (have_rows('about')): 

      while (have_rows('about')): the_row(); ?> 

     <h2><?php the_sub_field('content_area'); ?></h2> 

     </div><!-- .entry-content --> 

    </article><!-- #post-## --> 



    <?php endwhile; // End the loop. ?> 

    </main><!-- .site-main --> 

</div><!-- .content-area --> 
<?php get_footer();?> 
+0

私はすでにテンプレート名のコメントを入れていますが、誤ってコードから外してしまいました。編集しました。 – Ozzy

0

使用このそれは私が私は、新しいページの親ページを使用するために探していないよ、私の子供の起源のテーマ

<?php 
    /* 
     Template Name: Template Nmae 
    */ 
    ?> 
    <div id="primary" class="content-area"> 

     <main id="main" class="site-main" role="main"> 

     <?php 
     // Start the loop. 
     while (have_posts()) : the_post(); ?> 


     <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>> 

      <header class="entry-header"> 
       <?php the_title('<h1 class="entry-title">', '</h1>'); ?> 
      </header><!-- .entry-header --> 

      <div class="entry-content"> 


      <?php if (have_rows('about')): 

       while (have_rows('about')): the_row(); ?> 

      <h2><?php the_sub_field('content_area'); ?></h2> 

      </div><!-- .entry-content --> 

     </article><!-- #post-## --> 



     <?php endwhile; // End the loop. ?> 

     </main><!-- .site-main --> 

    </div><!-- .content-area --> 

    <?php get_footer(); ?> 
+0

それは私のために働いていない... – Ozzy

関連する問題