Forums

2.7 made a custom page template but can't find it (30 posts)

  1. A2annie
    Member
    Posted 3 years ago #

    Hi-
    I am new to WordPress and started on 2.7. However, I am not new to html & CSS.

    I made a new custom template with the plan to make a few custom templates. One for the home page and a couple for interior pages. All pages will have blog features turned off, but I want to have CMS features.

    I made a template using this:

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

    <?php get_header2(); ?>
    <?php get_sidebar(); ?>
    <?php if (have_posts()) : ?>
    <?php while (have_posts()) : the_post(); ?>
    <div id="post-<?php the_ID(); ?>">
    <h2>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></h2>
    <?php the_content('Read the rest of this entry »'); ?>
    </div>
    <?php endwhile; ?>
    <?php else : ?>
    <h2>Not Found</h2>
    <p>Sorry, but you are looking for something that isn't here.</p>
    <?php endif; ?>
    <?php get_footer(); ?>

    I put this page named tester.php in my theme directory on my server.

    However, now i cannot access it as the documentation says I should. It says I should be able to select this is a drop down on the page admin area. Where? see : http://codex.wordpress.org/Pages#Page_Templates

    What am I doing wrong

  2. MadsK
    Member
    Posted 3 years ago #

    When you Edit or Add a new page there will be a new option to the right below the dropdown, where you can choose parent page, that says Template. :)

  3. A2annie
    Member
    Posted 3 years ago #

    I see the parent page drop down - but that just has a list of the pages I've made.

    there's n area that says attributes. One says parent, below that is order.

    no access to templates.

    Any other ideas?

  4. MadsK
    Member
    Posted 3 years ago #

    Hmm. Sounds strange. Did you put it in the "root" of the theme directory? or in a folder?

  5. A2annie
    Member
    Posted 3 years ago #

    root

  6. MadsK
    Member
    Posted 3 years ago #

    Try making a new template with this

    <?php
    /*
    Template Name: Archives with Content
    */
    ?>

    and then just add header, sidebar and footer.

    Upload it and see if it shows up!

  7. A2annie
    Member
    Posted 3 years ago #

    I did this.
    I named the file tester.php

    <?php
    /*
    Template Name: Archives with Content
    */
    ?>

    <?php get_header2(); ?>
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>

    I logged out, and then back in.
    I've refreshed the browser window.

    I'm on a MAC using firefox. Please don't tell me I need to go to the other side of the room and use my pc... This cannot be a platform bug issue....?

    I need to leave for the night, but any other insights would be very very appreciated. I really want to have this site up and running within the next week or so and ir will rely heavily on custom pages.

    Thanks!

  8. MadsK
    Member
    Posted 3 years ago #

    It would be very strange if it was a platform issue.

    But check this site out - there is a fix here.

    http://www.elitefreelancing.com/2008/10/custom-page-templates-not-showing-up-in-wordpress/

  9. A2annie
    Member
    Posted 3 years ago #

    Thank you so much. We have progress, I now can get the drop down but it says:
    "mainPage */?> Not Found Sorry, but you are looking for something that isn't here"

    That's pretty weird... any ideas?

  10. MadsK
    Member
    Posted 3 years ago #

    Is this when you enter the page after giving it the template it says that?

  11. A2annie
    Member
    Posted 3 years ago #

    Okay, what happens is now the drop down for templates displays, but the items (other than the default page) say:
    mainPage */?> Not Found Sorry, but you are looking for something that isn't here

    Test Template */?> Not Found Sorry, but you are looking for something that isn't here

  12. Otto
    Tech Ninja
    Posted 3 years ago #

    Your templates have the wrong kind of carriage returns for your web server's system. What editor are you editing these templates in? Use Notepad, or the built in theme editor. Or Textpad, I use that one a lot and it works well.

  13. A2annie
    Member
    Posted 3 years ago #

    I use dreamweaver to edit code. I don't use the gui at all. But I write my own code. How can you tell that they are the wrong kind of carriage returns? What makes a right one? I'll try textedit, but I am hooked on dreamweavers tools... I'm surprised that it is changing the code.

  14. A2annie
    Member
    Posted 3 years ago #

    Hey there. I did this, wrote the page in textedit and now it does take the gook out of the drop down, but when I view the page, I just get the code - not the rendered code.

    Please help?

    Thanks!

  15. mrmist
    Forum Janitor
    Posted 3 years ago #

    Sometimes to get new page templates to show up in 2.7 you have to activate another theme and then active your normal theme again.

  16. Otto
    Tech Ninja
    Posted 3 years ago #

    If you get the code and not the rendered code, then something is wrong with your template. A missing <?php or something, perhaps?

  17. A2annie
    Member
    Posted 3 years ago #

    This is my code -
    I am not a php guru, but can get around. It appears fine to me...

    <?php
    /*
    Template Name: Main Page
    */
    ?>
    <?php get_header2(); ?>
    <?php get_sidebar(); ?>
    <?php if (have_posts()) : ?>
    <?php while (have_posts()) : the_post(); ?>

    <div id="post-<?php the_ID(); ?>">

    <h2>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></h2>

    <?php the_content('Read the rest of this entry »'); ?>

    </div>

    <?php endwhile; ?>

    <?php else : ?>

    <h2>Not Found</h2>

    <p>Sorry, but you are looking for something that isn't here.</p>

    <?php endif; ?>

    <?php get_footer(); ?>
    <?php the_content('Read the rest of this entry »'); ?>
    </div>
    <?php endwhile; ?>
    <?php else : ?>
    <h2>Not Found</h2>
    <p>Sorry, but you are looking for something that isn't here.</p>
    <?php endif; ?>
    <?php get_footer(); ?>

  18. iridiax
    Member
    Posted 3 years ago #

    Your code is duplicated after the first <?php get_footer(); ?>

  19. b-rad
    Member
    Posted 3 years ago #

    Whats get_header2()?

  20. A2annie
    Member
    Posted 3 years ago #

    hi-
    It's not duplicated in the actual file that was a posting error.

    get_header2() is to get a different header that get_header()

    is that unacceptable? That file is uploaded too. header2.php I've now tried with get_header() and it works. The only difference between header.php and header2.php is the title. I want them to have unique titles

    again, I am not fluent in php, but do know my way around code html/css

    Anyway, it does seem to be working now, but I am concerned about not being able to use get_header2()

    What is the best solution here?

  21. Otto
    Tech Ninja
    Posted 3 years ago #

    get_header2 won't work, that's the wrong way to do it.

    Try get_header('header2') instead.

  22. insomni4k
    Member
    Posted 3 years ago #

    I have this problem too... and I find out that some theme have this and some are not. I haven't found the problem yet, and I guess the problem is from the template, try to change other WP theme.

  23. zacheos
    Member
    Posted 3 years ago #

    I can confirm this is an issue with 2.7. I tested and re-tested this sever times in several ways and I end up with the same results.

    The only way for me to get 2.7 to recognize that I have added a new page template, is to temporarily activate another theme and then switch back to the preferred theme.

    Hope this helps.

  24. icerabbit
    Member
    Posted 3 years ago #

    Same issue here.

    WP 2.7 upgraded from previous versions.

    Created a custom template page.
    Created a new page.
    WP does not present me with the option to pick a different template.

    Switched back to default theme and to the custom one.

    Still no option to pick the custom page template.

  25. icerabbit
    Member
    Posted 3 years ago #

    Update.

    I forgot to add the

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

    So between switching to default for a few seconds and adding the above to the custom page; I can edit the page and select the custompage from the attributes.

  26. javier.faus
    Member
    Posted 2 years ago #

    Did you substitute your index.php file with your new tester template?

    That would break down the theme. If you did, just undo, reload the theme and edit your tester template in a different php file.

    It did work for me.

    Javier.

  27. 1saucygirl
    Member
    Posted 2 years ago #

    Have you tried saving your .php file in a straight-up text editor rather than Dreamweaver, and then checking to see if WP will recognize it? Your problem sounds very similar to one I had recently when trying to use a child theme I'd created using DW to edit the code. The code itself was exactly the same, but something about the way DW saved it caused an error with WP. When I saved the exact same file in Dashcode (or TextMate or whatever) it worked fine. Maybe worth a shot.

  28. apam
    Member
    Posted 2 years ago #

    Same behavior here working on OSX 10.5 working with FFox but was just a matter of deactivating and reactivatinf theme...
    Hope this issue gets fixed.
    Thanks for the tip!

  29. Jany @ Shambix
    Member
    Posted 2 years ago #

    For some strange reason, this happened to me too.
    I have WP 2.8.4.

    I had my own theme for a while, everything working perfectly, then one day I made a custom template for 1 page... but I couldnt see the dropdown selection anywhere.

    So i followed the tip, activated another theme, then again mine, went back to the page...and the dropdown was there!

    Oddness...

  30. forcetwelve
    Member
    Posted 2 years ago #

    hey - i had ther same prob and i activated a different theme, then reactivated my desired theme and it worked.

Topic Closed

This topic has been closed to new replies.

About this Topic