WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Including PHP inside Pages (8 posts)

  1. DaveDeLong
    Member
    Posted 9 years ago #

    Hi,

    How can I have PHP code execute inside pages? I want to make a contact form on a Page, but all my <?php ?> stuff just prints out like text.

    Thanks,

    Dave

  2. Michael Bishop

    Posted 9 years ago #

    One option would be to design a template with the php hardcoded into the page, an easier option is to use a plugin like PHP Exec as I use. It provides a simple quicktag that insert when writing the Page, then you just add the code. Works like a charm for me.
    I do believe there's at least one other plugin, in all fairness.

  3. pascalou127
    Member
    Posted 9 years ago #

    Hi,
    I use runPHP to have php code in my posts.

    If you want a contact form you might want to take a look at WP-ContactForm which is also very nice plugin.

  4. DaveDeLong
    Member
    Posted 9 years ago #

    Thanks!

    I wasn't able to get runPHP working immediately, so I decided to give PHP Exec a try. That seems to work fine.

    That WP-ContactForm is a rather nifty plugin! Thanks for pointing it out.

    Thanks a bunch!

    Dave

  5. Michelle
    Member
    Posted 8 years ago #

    Is anyone else just not able to get any of these plugins to work? Installed and activated both RunPHP and PHP Exec and when I type

    <phpcode>
    <?php get_links(2, '<span>', '</span>', '', TRUE, 'url', FALSE); ?>
    </phpcode>

    into a page or post edit textarea and save it shows up on the post or page exactly as typed above.

    I'd really like to get this to work, because I like to switch out my template / look and feel fairly frequently and it's driving me nuts having to recreate all page/template functionality every time I choose a new template set. Does that make sense?

    Thanks, Michelle

  6. McShelby
    Member
    Posted 8 years ago #

    You could also try my Exec PHP plugin. I wrote it specifically because of issues when also using quotes in the posts.

  7. Roar
    Member
    Posted 8 years ago #

    McShelby, I just used your plugin and it ROCKS. Works perfectly on my page.

    http://www.tuckle.net/?page_id=3636

    On that page I run the todayAgo plugin. So thank you!

  8. jonerik
    Member
    Posted 8 years ago #

    i dont get it to work, my wp just makes a space in the middle of < and the ? so it gets like < ? php include('.........') ?>

    edit: now i get it to work BUT!

    I get this error.
    Parse error: parse error, unexpected T_INCLUDE in /www/htdocs/spoken/wp-content/plugins/runphp.php(96) : eval()’d code on line 1

Topic Closed

This topic has been closed to new replies.

About this Topic