WordPress.org

Ready to get started?Download WordPress

Forums

Injecting PHP code into a Page (7 posts)

  1. roelabspoel
    Member
    Posted 8 years ago #

    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..

  2. moshu
    Member
    Posted 8 years ago #

    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

  3. roelabspoel
    Member
    Posted 8 years ago #

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

  4. DanBollinger
    Member
    Posted 8 years ago #

    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.

  5. Samuel B
    moderator
    Posted 8 years ago #

    Hi Dan Bollinger,
    Is it working now?
    Sam Bollinger

  6. DanBollinger
    Member
    Posted 8 years ago #

    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.

  7. Samuel B
    moderator
    Posted 8 years ago #

    "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.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags