• 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 : https://codex.www.ads-software.com/Pages#Page_Templates

    What am I doing wrong

Viewing 14 replies - 16 through 29 (of 29 total)
  • Thread Starter A2annie

    (@a2annie)

    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(); ?>

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

    Whats get_header2()?

    Thread Starter A2annie

    (@a2annie)

    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?

    Moderator Samuel Wood (Otto)

    (@otto42)

    www.ads-software.com Admin

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

    Try get_header(‘header2’) instead.

    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.

    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.

    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.

    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.

    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.

    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.

    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!

    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…

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

Viewing 14 replies - 16 through 29 (of 29 total)
  • The topic ‘2.7 made a custom page template but can’t find it’ is closed to new replies.