WordPress.org

Support

Support » How-To and Troubleshooting » Injecting PHP code into a Page

Injecting PHP code into a Page

  • How can i add PHP code into a Page content (not template)?
    Point is, i have downloaded a rating script, this script can be called like:

    <?
    $rater_id=1;
    $rater_item_name=’Item 1′;
    include(“rater.php”);
    ?>

    I can call it from a template without a problem, but i want to be able to rate a Page. So i thought in the Page content i put the above code and change the vars as needed.
    However all php code is shown as text instead of executed.

    And if this is not possible, can i put it in the template and how can i make the 2 vars unique for every called Page?

    Thanks for any help..

Viewing 6 replies - 1 through 6 (of 6 total)
  • 1. There are plugins for rating…
    2. You cannot use code in the content area (neither in posts nor in Pages), unless:
    you install and activate one of the many plugins that allow you to run PHP in a post/Page.
    Saerch the Codex >> http://codex.wordpress.org/Plugins and this forum for phpexec, execphp, runphp and similar keywords

    Ok.. found “Post Star Rating” and it works great!
    Thanks for the quick reply!

    I am using runPHP within a page and it does what it says, although it is not compliant for Opera.

    What I did was drop in the old Basic Post PHP code (see sidebar.php in WP2.0.2) to create a way for registered Contributors to send posts (not comments) as drafts to Editors.

    However, I got the dreaded “Enable Sending Referrers” error even though this was enabled.

    Hi Dan Bollinger,
    Is it working now?
    Sam Bollinger

    Hi, cousin! Are you in the US? They say all the Bollingers in the US are related to two brothers who immigrated around 1800.

    Still getting the Referrer error or can’t find post.php error depending on the code I send.

    “Hi, cousin! Are you in the US? They say all the Bollingers in the US are related to two brothers who immigrated around 1800.”

    I believe it from the geneologies my brother has run.
    I live in Fort Worth, TX.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Injecting PHP code into a Page’ is closed to new replies.
Skip to toolbar