WordPress.org

Ready to get started?Download WordPress

Forums

New page (12 posts)

  1. indeed
    Member
    Posted 9 years ago #

    Hi, i've just installed WordPress 1.5.1 and it's working fine. I've got one question though. First, let me explain what I think about what the following things are:

    Pages: static webpages coming fron the database.
    Posts: A daily post, etc.

    What I want is a new static post, with some PHP in it. Is it possible to create it by using the Admin interface? I want the link to the static page to appear in the same list as the other static pages (created with the admin interface)

  2. Minna
    Member
    Posted 9 years ago #

    For using PHP on pages you either need to make a page template or get a plugin that allows PHP code in pages/posts (PHP Exec for example).
    I personally prefer the plugin approach but they may have limitations (haven't tested out PHP Exec yet). But especially if the page would only have PHP code, the page template approach could be simpler (?!?).

  3. indeed
    Member
    Posted 9 years ago #

    But the only way to create a template is by creating a .PHP-file and upload it to the template directory? Isn't there a plugin for the admin interface to easily creat a new template?

  4. Minna
    Member
    Posted 9 years ago #

    Not that I know of. Uploading is really easy though, is there a specific reason you need the ability to create new files through admin panel?

  5. indeed
    Member
    Posted 9 years ago #

    No, there isn't. By when I upload a template-file (PHP), the URL is not very nice. I'm using '/archives/%post_id%' as a permalink. What would be the 'nice' url to the new template?

  6. Minna
    Member
    Posted 9 years ago #

    well, if you used that template on a page the url would be your-blog.xyz/page-slug (the slugs are created with same logic as post slugs, but you can change the slug in page options). After you've created the template you need to create a new page and choose that template in the Page template dropdown menu

  7. indeed
    Member
    Posted 9 years ago #

    I really can't find the 'page template dropdown menu'. I've uploaded a new template-file called 'refer.php' (also tried test.php).

    Then I created a new page, added some text and tried to 'link' it to the template, but couldn't find the dropdown :(

    I've really searched everything, but I cannot find the template drop-down-menu in the 'create page'-screen.

  8. Minna
    Member
    Posted 9 years ago #

    A page template is something like this
    <?php
    /*
    Template Name: Refer
    */
    ?>
    some text, code, whatever

    and maybe get_header(), get_sidebar(), get_footer(), whatever you might have in the other templates.
    You'll have to put the text that you want on the page in the template file and leave the newly created page empty (content wise, that is). If you don't see the drop down you may have a misformed template.

  9. indeed
    Member
    Posted 9 years ago #

    I've been doing some testing and you're right!
    When I choose the default template, I can choose the template. Either when I use the (price winning) template 'Red Train', I cannot see the template-drop-down menu. What can I do about it?

    The link to the template can be found here.

  10. Michael Bishop

    Posted 9 years ago #

    Where did you upload your template to? Is it in your redtrain directory? Did you put "Template Name:xxxx" in the header of the file?

  11. Minna
    Member
    Posted 9 years ago #

    miklb is right, you need to have the page template in the folder of the active theme (or the theme you'll be using the template with)

  12. indeed
    Member
    Posted 9 years ago #

    It's working fine now, thanks! The following lines were missing in the template-file:

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

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags