• Hello,

    I have WP installed in /blog/. I am trying to create a new page in the template, and after searching through the forums, I see it mentioned to put in this code

    <?php
    define('WP_USE_THEMES', true);
    require('./wp-blog-header.php');
    ?>

    I’ve tried a variety of different path combinations, and continue to get the “no such file or directory” error. And yes, I have double-checked, and I see wp-blog-header.php in the blog root (/blog/wp-blog-header.php).

    Any ideas?

Viewing 9 replies - 1 through 9 (of 9 total)
  • <?php include (TEMPLATEPATH . (‘wp-header.php’); ?> perhaps?

    I’m a long time designer but I’m new to WP (this month) so that may or may not work!

    Jonji

    Thread Starter CSKnet

    (@csknet)

    Thanks for your reply, but that won’t work. wp-blog-header.php is needed to allow all WP functionality, and it is in the WP root directory, not the template directory. 🙁

    Any other takers?

    I am trying to create a new page in the template

    You need to explain this… it doesn’t make much sense as you wrote.

    By template file do you mean a new page template? If so you’ll have to use this code

    <?php
    /*
    Template Name: YOUR TEMPLATE NAME
    */
    ?>

    Oh that!
    Well, it is in the Documentation, just read it…
    Pages#Page_Templates

    Thread Starter CSKnet

    (@csknet)

    Jeremy – thanks, yes, I have that in there.

    Moshu – I have read it…Yes, I am creating a page within a theme, that I will link to, and want all WP functionality within that page.

    My current theme has an archive.php. I am creating “archives.php” to be a very customized archives page that I am building.

    The beginning of the page code is thus:

    <?php
    /*
    Template Name: archives
    */
    ?>
    <?php
    define('WP_USE_THEMES', true);
    require('./wp-blog-header.php');
    ?>
    <?php get_sidebar(); ?>

    And I still get the above error

    archive.php is NOT a Page template.

    archives.php must be a Page template. And as Jeremy told you, this is what you need:

    <?php
    /*
    Template Name: archives
    */
    ?>
    
    <?php get_sidebar(); ?>
    etc etc

    Don’t over-complicate.

    And NO, you can never link directly to a Template file. Don’t even try. You create a new Page (in Write subpanel) using that new template.

    Thread Starter CSKnet

    (@csknet)

    Thanks Moshu, although you did say the same thing as before, which I addressed, and added some rudeness. I still say thanks.

    No, you did not address it: you have the “require…” code lines in your template file and those are not needed for a template file that is located in the theme folder.

    If you want to do something else, then explain it (without smartass remarks).

Viewing 9 replies - 1 through 9 (of 9 total)

The topic ‘Can’t WP-ify new template file’ is closed to new replies.