WordPress.org

Ready to get started?Download WordPress

Forums

Word press pages and php (4 posts)

  1. nydanv
    Member
    Posted 7 years ago #

    Hello all I am a new user to word press and love it. I know php very well and have tried both runPHP and phpexec plugs in my word press.

    I am trying to create a simple form using php or even echoing something like this <?php echo "test" ?> and it does not seem to be working on my pages. I am not needing php to function in posts just pages I create.

    I have read through the documentation and not really sure if I am going about it the right way. Should i be creating a template which contains my entire php?

    Rich text editor is off and i also removed the "check if xhtml". Thanks for any advice.
    Daniel

  2. Chris_K
    Member
    Posted 7 years ago #

    I tend to create Page Templates that contain my coding and just use WP to create a new Page, associate it with that new template and dump some (if any) text on it.

  3. nydanv
    Member
    Posted 7 years ago #

    Handy solo thanks for the quick reply.

    This is what I have done and failed.

    Created snarfer.php with the below:
    <?php
    /*
    Template Name: Snarfer
    */
    echo "test";
    ?>

    I moved the file into /wp-content/themes
    *Note not sure if i am putting the file inthe correct location. I am using a dark-maple theme so should I place this snarfer.php into /wp-content/themes/dark-maple

    Either way in my word press editor I do not see the template in the "template pulldown" and when i inser this code...in the page html <?php include (TEMPLATEPATH . '/snarfer.php'); ?> nothing happens.

    Thanks for all your help.

  4. nydanv
    Member
    Posted 7 years ago #

    Hey I think I figured it out.

    The php template needs to be in the theme you are using directory.

    I took an already in place template and placed
    <?php
    /*
    Template Name: snarfer
    */
    ?>

    on the first 5 lines. Then edited the code between <!--div content starts--> (php stuff go here) and <!--div content end-->

    Seems to be working. Thanks.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags