WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Parent theme templates not working in child theme (8 posts)

  1. gregwhitworth
    Member
    Posted 2 years ago #

    Hey Guys,

    I have a parent theme that I am using and for some reason the page templates are not appearing in the drop down for pages. I know that they are setup right as the second that I drag them into the child theme the drop down appears. Do I have to have the page templates in the child theme? I was hoping to keep the parent theme as together as possible so that I only had to create what I needed in the child theme.

    Thanks in advance.

    Greg

  2. Rev. Voodoo
    Volunteer Moderator
    Posted 2 years ago #

    That shouldn't be the case. I use a child theme of 2011 on VoodooPress, and have templates available to select which reside on both the parent and child themes.

    If you add a template to the child theme to make the dropdown appear, does it only include templates from the child, or do the templates form the parent and child appear?

  3. gregwhitworth
    Member
    Posted 2 years ago #

    Yes. Only from the child theme, very confusing. I have used other parent themes/ frameworks before and have never run into this problem. Now I am developing a more streamlined one for myself and am not sure what the issue is here.

    Here is one of my templates:

    <?php
    /** Template Name: Full Width */
    update_option('current_page_template','temp-full-width');
    
    get_header(); ?>
    
    <div id="primary">
        <div id="content" role="main">
            <?php the_post(); ?>
    
            <?php get_template_part( 'content', 'page' ); ?>
    
        </div><!-- #content -->
    
        <div class="clear"><!-- --></div>
    </div><!-- #primary -->
    
    <?php get_footer(); ?>

    One thing that I am curious that might be the problem is the get_template_part as those files reside within the parent theme. Not sure if that is indeed the problem but I am at my wits end with this.

  4. gregwhitworth
    Member
    Posted 2 years ago #

    Just to explain it a little better as my last post is a little confusing, here is an example of my directory:

    /wp-content/
         /themes/
              /parent/
                   ... other theme files are here ...
                   template-liquid.php
                   template-blog2.php
                   template-magazine.php
             /child/
                    ... other theme files are here ...
                   template-full-width.php

    So when editing the page the only template in the drop down is Full Width. Thanks again for the help.

  5. esmi
    Forum Moderator
    Posted 2 years ago #

    So when editing the page the only template in the drop down is Full Width.

    That sounds like the parent theme is not child-theme-friendly. You should have access to all of the template files in the parent theme as well as an unique templates in the child theme.

  6. gregwhitworth
    Member
    Posted 2 years ago #

    Ok, figured it out. I was looking at the CODEX to see if it said anything after @esmi saying the theme wasn't child-theme-friendly. And I saw this line:

    Template. (required) directory name of parent theme, case-sensitive.
    NOTE. You have to switch to a different theme and back to the child theme when you modify this line.

    At one point I read the 'case-sensitive' part so I changed this and forgot to refresh switch themes. I did this and now all templates are visible. Stupid mistake! Thanks guys!

  7. gregwhitworth
    Member
    Posted 2 years ago #

    Ok, figured it out. I was looking at the CODEX to see if it said anything after @esmi saying the theme wasn't child-theme-friendly. And I saw this line:

    Template. (required) directory name of parent theme, case-sensitive.
    NOTE. You have to switch to a different theme and back to the child theme when you modify this line.

    At one point I read the 'case-sensitive' part so I changed this and forgot to refresh switch themes. I did this and now all templates are visible. Stupid mistake! Thanks guys!

  8. esmi
    Forum Moderator
    Posted 2 years ago #

    No problem :-)

Topic Closed

This topic has been closed to new replies.

About this Topic