• This is a wonderful little time saving plug-in. However, it’s really intended for folks who know a little PHP coding. If you use Advanced Custom Fields, this is a gem. If you don’t use Advanced Custom Fields, you should. It is so awesome. Once you climb the learning curve, you’ll be amazed at how quickly you can develop complete, custom and eye catching WordPress Themes and Templates. Anyway, I digress.

    The documentation isn’t really “bad” so much as it assumes the end user knows his way around WordPress. In addition, there is some code in the plugin that needs to be changed as it is deprecated. It’s mentioned in other posts here. I’ll get to all of it.

    To get this to work, follow these steps:

    –> Step 1

    First, you need to update the plugin code as explained by super powered in an earlier post. It’s easy. Takes seconds. You can install the plug-in and edit these lines in the Admin panel.

    …………………
    From super powered —

    But if your using WordPress 4.1 youll need to change 3 lines of code in the plugin file, since get_themes() & get_current_themes() were both depricated.

    It’s rather simple:

    wp_content>plugins>wp-custom-post-template>wp-custom-post-template.php

    On lines 85, 86 & 87 change:

    $themes = get_themes();
    $theme = get_current_theme();
    $templates = $themes[$theme][‘Template Files’];

    to:

    $themes = wp_get_themes();
    $theme = wp_get_theme();
    $templates = $theme[‘Template Files’];

    —————————-

    –> Step 2

    You need to create a new template page with the WP Post Template: tag and upload it to the ROOT of your THEME FOLDER.

    Template tag has the following format:


    <?php
    /* WP Post Template: Name of New Template */
    ?>

    Note that “WP Post Template” must proceed the name of your new template.

    –> Step 3

    Create your new template layout. This is where you need some skills. I might be nice and write a little tutorial about all this if anyone expresses interest.

    –> Step 4

    Name and save your new template page. I name my post template pages sort of like this — “Post_Template_for_Events.php ” and upload it to the ROOT of your Theme Folder. This is probably what is confusing most folks. You can tweak the code to specify a new theme folder for your posts. But, I won’t get into that. However, I do like to keep things tidy and everything in it’s place.

    –> Step 5

    Now you should see the new template in the drop down.

    Little Starter Page Example Below.

    ——————————–

    <?php
    /* WP Post Template: My Custom Template Name */
    ?>
    <?php get_header(CustomHeader); ?>

    …. Your layout Here ….

    <?php get_footer(CustomFooter); ?>

    ———————

    Hope this makes sense to someone.

    Showing some love from New Orleans

    Mark

    ———————————-

Viewing 3 replies - 1 through 3 (of 3 total)
  • Great tips Mark, thanks!

    I was able to get it working with a parent theme but not a child theme. Have you attempted this at all?

    It seems the post template files need to be located in the parent theme directory to show up in the dropdown on the back-end. However, this causes an error on the front-end:

    “Warning: include(C:\workspace\sites\example.com\public_html/wp-content/themes/Royal-child/post-template-contest.php): failed to open stream: No such file or directory in C:\workspace\sites\example\public_html\wp-includes\template-loader.php on line 75”

    If I move the template files back to the child theme directory, it works on the front-end but I’m left with an empty dropdown on the back-end.

    Has anyone had any luck configuring this correctly? I’m using the latest WordPress 4.3.

    Thanks,

    Zack

    Hi Mark,

    Thanks a lot for writing the guidance.
    You’ve also wrote that you might be nice and make a little tutorial about step 3 if anyone expresses interest.

    Are you still willing? It would help me a lot, as I’m having troubled with this step.

    Thanks a lot!
    Erika

    This does not work in the latest version WP

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Works Fantastic. Here Sum TIps’ is closed to new replies.