Forums

[resolved] applying different template to page (19 posts)

  1. hallwayorchard
    Member
    Posted 5 years ago #

    Hi All,
    I have a number of stand alone pages that I would like to display minus the sidebar. I think I understand how to make a custom page template but how do I apply that template only to those specific pages?

    Thanks.

  2. moshu
    Member
    Posted 5 years ago #

    If you have more than 1 Page template (i.e. the default page.php + at least one) - in the Write Page area there will be a Page Template dropdown to select the template you want. The option is NOT visible if you don't have Page templates...

  3. hallwayorchard
    Member
    Posted 5 years ago #

    cool
    thanks a ton!

  4. hallwayorchard
    Member
    Posted 5 years ago #

    hmmmm i'm missing something. When I create my new php page I can't see anywhere in the edit or create page area to choose it.

  5. moshu
    Member
    Posted 5 years ago #

    Maybe you didn't read carefully: you do NOT create new php pages - you create new Page Templates!

    http://codex.wordpress.org/Pages#Page_Templates

  6. hallwayorchard
    Member
    Posted 5 years ago #

    I'm super confused :)

    I created a page2.php file in my theme directory. At the top of the file I put the following:

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

    When I go to write a page the only options I see are Discussion, Password-protect post, Page parent, Post slug, Post author, and Page order.

    Am I missing something?

    Thanks for the help and the patience...

  7. Chris_K
    Member
    Posted 5 years ago #

    Hrmm... it should be between Parent and Slug.

    Those little blue boxes are all Ajax'd up. If you drag a few around to re-order them, does Template pop up?

  8. hallwayorchard
    Member
    Posted 5 years ago #

    Nope... I drag those boxes all over the place... no page template to be found.

  9. Chris_K
    Member
    Posted 5 years ago #

    You're positive it's in the current/active theme's directory?

    What happens if you change page2 to something without "page" in the name? (yes, I'm grasping)

  10. hallwayorchard
    Member
    Posted 5 years ago #

    I'm positive.
    I even tried the same proceedure in the default theme. Same results.

    I've tried renaming to half a dozen different names, each time changing the "Template Name:" field within the file.

  11. sadish
    Member
    Posted 5 years ago #

    you do not see a page template dropdown at all ? or you are not seeing page2 as an option in the dropdown ?

    did you make sure, you have the page2.php on the active theme's directory ? this dropdown only pulls it from the active theme's directory.

  12. hallwayorchard
    Member
    Posted 5 years ago #

    That is exactly correct,
    1) I do not see (and have never seen) a page template dropdown.
    2) The page2.php (or whatever name I call it) file is in the active theme's directory.
    3) I have tried adding another page template to other themes (ie default), and making them active, but have the same results.

  13. moshu
    Member
    Posted 5 years ago #

    That's totally strange. On a local install (XAMPP) I tried to reproduce your error: made a page2.php in the default theme and I copied over even the heading for template name as you posted above - but it shows up normally in the dropdown.
    Actually, the Default comes with more than one Page templates, so the dropdown should be there regardless of your own template!

  14. hallwayorchard
    Member
    Posted 5 years ago #

    I wonder if it could be an installation issue. Do you need any special rights on the theme folder?

  15. hallwayorchard
    Member
    Posted 5 years ago #

    Well, I've tried a completely new install and got the same result.

    My hosting is on Godaddy.com

    Is there any other information that could be helpful?

  16. moshu
    Member
    Posted 5 years ago #

    You should have started with that!

    Try to search for goddady here in the forum.

    Also, you are a Win server, which can always cause surprising things...

  17. sadish
    Member
    Posted 5 years ago #

    take one of my themes GreenFlower / MistyLook from wpthemes.info and activate it and see if you are getting the page template box at the right.

    I have tested it in multiple installations and lets see if it works with you.

    Sadish

  18. hallwayorchard
    Member
    Posted 5 years ago #

    YES
    I did not think to include Godaddy with my search (and should have known better considering the host of other issues it caused)

    Torifile had the answer:
    In the ADMIN_FUNCTIONS file
    the following line needed to be commented out:
    //$template_data = implode('', file(ABSPATH.$template));

    And the following line was put in:
    $template_data = file_get_contents(ABSPATH.$template);

    This worked great and I can see my Page Template option now.

    Thanks to everyone for all the support and advice!

    Cheers!

  19. sadish
    Member
    Posted 5 years ago #

    I do not understand why you have to fiddle with the wp core code, to get this thing to work.
    anyway, if Torifile helped you well before, I would have saved my time.

    Sadish

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.