WordPress.org

Forums

Create a placeholder page for a plugin (3 posts)

  1. _OMEGA_
    Member
    Posted 5 years ago #

    Hi all, I need some help.
    I'm coding my own plugin, and I have this problem.
    I'd like to create a placeholder page where the plugin can display the result in the frontend.
    Unfortunatelly I don't know how to code it!

    Anyone could help me please?

  2. Michael
    Forum Moderator
    Posted 5 years ago #

    look into the codex, under page template:

    read this first, or again if you have read it already:
    pages:
    http://codex.wordpress.org/Pages
    http://codex.wordpress.org/Pages#Creating_Your_Own_Page_Templates

    make a copy of index.php and call it 'my-page-template.php' for instance.
    edit it and put this code into the top:

    <?php
    /*
    Template Name: My Page Template for plugin
    */
    ?>

    save it.

    in 'admin' - 'pages' - 'add new': make a new page with the title 'Placeholder' - or whatever; the content does not matter, you may want to put a note into it, that this page is a placeholder with a diferent page tmeplate - it will not be shown anyway.

    on the right under 'attributes' 'template' click the drop down menu and select 'My Page Template for plugin'.

    save and publish the page.

    edit the 'my-page-template.php' and put your plugin code into it or whatever.

    you should be able see your new page under the pages lists.

  3. _OMEGA_
    Member
    Posted 5 years ago #

    Ok but in this way I have to put the 'my-page-template.php' into the template directory, am I right?
    There's a way to have all in the plugin Directory?

Topic Closed

This topic has been closed to new replies.

About this Topic