Support » Fixing WordPress » Including PHP inside Pages

  • Resolved DaveDeLong

    (@davedelong)


    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

Viewing 7 replies - 1 through 7 (of 7 total)
  • 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.

    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.

    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

    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

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

    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!

    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

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Including PHP inside Pages’ is closed to new replies.