WordPress.org

Ready to get started?Download WordPress

Forums

Custom page template in Edit Page dropdown list (16 posts)

  1. derek642
    Member
    Posted 2 years ago #

    Based on the below post I just read:
    http://wordpress.org/support/topic/template-pages-not-showing-in-dropdown-list?replies=19

    It sounds like this may be something I can do to get my custom page template to show up on the Edit page Admin screen (in the dropdown list)

    My situation is that I created the custom page template, put it in my theme folder, it comes up in the Widgets section for adding sidebars for that specific page template, BUT it is not listed in the dropdown list when I edit a page (the dropdown shows up and has other page templates, just not the new one I just created)

    Based on the above post, I am thinking I can just ftp my customer page template to the other theme folders. Because of the extent of pages, and changes I have done to this site so far, I don't want to change the theme incase that would cause more problems.

    Will just FTP'ing my custom page template to the other theme folders be enough given my situation briefly explained above?

    Thanks! ~Derek

  2. ahuggins
    Member
    Posted 2 years ago #

    It's sort of hard to figure out what you trying to do.

    Are you using a custom post type? If so, the page template for the custom post type should be either single-{post_type}.php or archive-{post_type}.php where you replace {post_type} with the name of your post type. These would not show in the drop down because WordPress uses them automatically when viewing that content type. See this for more info on that: http://codex.wordpress.org/Post_Types

    If you are just trying to create a new page layout, you added the template name in the php at the top of your file?? Like:

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

    If you want, and are comfortable with posting your code online, you can use pastebin.com and paste the code of your template file in there so I (or others) would be able to see if we can figure out what's going on.

    Hope that helps,
    Andy

  3. derek642
    Member
    Posted 2 years ago #

    @Andy - Thanks for the reply. I am not trying to use a custom post type - I don't think! ;-)

    What I am trying to do is display certain sidebar menus based on the page group is viewed, so to do that I tried tocreate a new page template - that has right sidebar - and then I could be able to setup what sidebar widgets to use for the specific page template.

    The New page template I created shows up in the Admin>>Widgets section as a page template, but not on the Admin>>Edit Page screen as one of the dropdown options.

    If it helps at all I'm using the Swift Theme...

  4. derek642
    Member
    Posted 2 years ago #

    Also... I do have that Template Name at the top of the file...
    I actually used an existing page template file, that had right sidebars, and saved as different file name and changed the Template Name section at the top. Thanks again!

  5. ahuggins
    Member
    Posted 2 years ago #

    Just to make sure, you have reloaded the page?

  6. ahuggins
    Member
    Posted 2 years ago #

    what's the name of your file?

  7. derek642
    Member
    Posted 2 years ago #

    @Andy - Thanks. Yes I did reload the page, and logout and login also...

    the page template name is page-temp-studylearn.php (exact name convention as the other ones which is page-temp-[name].php)

    and the file path is:
    .../wp-content/themes/swift/page-temp-studylearn.php

    unfortunately I am at 'work' now, so I cannot post the code from the file itself at this time...

    Thanks again

  8. ahuggins
    Member
    Posted 2 years ago #

    I would suggest trying to name the file studylearn.php and see if that at least gets it to show up.

  9. ahuggins
    Member
    Posted 2 years ago #

    Another option would be to create a new file, name it something completely unique and just for testing purposes, maybe templatetest.php, add the template name to the file:

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

    Then don't put anything else in the file, and see if that works. Then you would know that WordPress is working correctly, and there must be an issue in your code.

  10. ahuggins
    Member
    Posted 2 years ago #

    what version of WordPress are you running?

  11. derek642
    Member
    Posted 2 years ago #

    WordPress version is 3.4. I will try to rename the file to just studylearn.php and let you know.

    I added this template name to the sidebar-init.php file to initialize it - I'm guessing for the admin>>widgets section. Is there perhaps another WP config file I need to add this to for the template page dropdown of the edit page also?

  12. derek642
    Member
    Posted 2 years ago #

    Ok... quick update!
    First off, I WAS BLIND BUT NOW I CAN SEE!

    The template name I put in the top of the file was the same name as the other page template (so I never changed the top name)

    I changed the name in the file, re-uploaded it via ftp and tried to goto edit page and it is listed now...

    @Andy - Thanks for all your help!

  13. ahuggins
    Member
    Posted 2 years ago #

    Cool, great.

  14. edanweis
    Member
    Posted 2 years ago #

    I am having the same problem reported here and in other forum posts. However, none of these solutions work for me. I have tried logging in/out, switching themes, re-uploading files, double-checked php files, template names. Using the Roots Theme .

    Any further suggestions?

  15. ahuggins
    Member
    Posted 2 years ago #

    @edanweis - Have you tried creating another file, name it something like templateexampletest.php, add the template name php comment:

    <?php
    /* Template Name: Template Example Test */
    ?>

    Then FTP that to your server and see if that one works.

    If you do that and it that doesn't show up, then it's probably beyond me. If that template (which does nothing) shows up in the list, then you would know there is an issue with either the name of the file, or something in the file.

    It's really hard to guess at these things without being able to look at the files and troubleshoot them.

  16. edanweis
    Member
    Posted 2 years ago #

    It works now, I thought I tried that before.. my apologies... thank you!!

Topic Closed

This topic has been closed to new replies.

About this Topic