WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Custom Post Template Not Being Applied (6 posts)

  1. sierrajoe
    Member
    Posted 4 years ago #

    I have installed and activated the plugin and created a custom template. I have assigned the custom template to a particular post and can see the custom field that was created on the post.
    However, the single.php template is being applied rather than my custom template.

    my custom template file name is trails_single.php.
    At the top of the file I have:

    <?php
    /*
    Template Name Posts: trails_single
    */
    ?>

    The remainder of the file is a copy of my single.php code with the addition of an echo statement to let me know which template I'm actually looking at.

    Any ideas???
    Thanks,
    joe

    http://wordpress.org/extend/plugins/custom-post-template/

  2. sierrajoe
    Member
    Posted 4 years ago #

    Well... I found a workaround but it is not pretty!
    I am using a child theme of the arras theme.
    I already have a child single.php in my child theme.
    What I discovered was that if I put the new custom post template file in my child theme directory it is discoverd by the plugin but it is not applied.
    Just as an experiment I tried putting another copy of the custom post template inside the parent theme and guess what... it is now applied.

    This is not good though because a parent theme upgrade could potentially wipe out my custom post templates :-(
    joe

  3. sierrajoe
    Member
    Posted 4 years ago #

    One step further...
    I discovered that the custom post template is both recognized and used if it is inside the parent theme even if not present at all inside the child theme that is being used.
    This seems counter intuitive to me.
    joe

  4. sierrajoe
    Member
    Posted 4 years ago #

    I think I've got it working in a child theme now. I replaced several instances of "TEMPLATEPATH" with "get_stylesheet_directory()"
    TEMPLATEPATH returns the path to the parent directory whereas get_stylesheet_directory() returns the path to the child.

    There is one instance of get_template_directory(), but it seems to be ok because it is accompanied by get_stylesheet_directory().

    joe

  5. davehapawordpress
    Member
    Posted 4 years ago #

    sierrajoe - this has just started happening to me with the arras theme. I'm not able to get it to use the custom theme at all even if I put it in the arras directory.

    I can select it in the page editing interface but it will not use the selected theme.

    I'm going to go see what I can find on the arras site.

  6. helgatheviking
    Member
    Posted 4 years ago #

    http://wordpress.org/extend/plugins/custom-post-template/download/

    The developmental version works w/ child themes (without the hackery I posted elsewhere).... so I suspect it will work in the next version.

Topic Closed

This topic has been closed to new replies.

About this Topic