2016-04-12 3 views
0

Я новичок в PHP, и я создал свой первый настраиваемый шаблон страницы, используя структуру Genesis.Шаблон страницы не отображается в выпадающем меню

Я создал дочернюю тему для основного родителя Genesis, она активна и узнаваема как ребенок, на панели тем не существует ошибок.

Проблема заключается прямолинейно, когда я помещаю шаблон в родительский каталог, без проблем, он отображается в раскрывающемся меню выбора шаблона страницы при создании новой страницы, однако, когда я помещаю его в детскую тему, он показывает сейчас.

Я попытался скопировать 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

Я не ищу, чтобы использовать родительскую страницу для новой страницы, я m глядя использовать шаблон страницы для новой страницы, которую я не могу сделать, если я не помещаю шаблон в родительскую тему, он не работает через дочернюю тему ... – 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

Смежные вопросы