WordPress.org

Forums

adding regular php variables in a post (2 posts)

  1. jordb
    Member
    Posted 7 years ago #

    Hey,
    im trying to add a simple php variable in a wordpress page i have created, however it doesn't seem to work.

    I have installed the plugin "runPHP" because i was told thats what i need to use. however i can't seem to get this to work.

    in my page i added:

    <?php
    $bgimage = "test";
    ?>

    and on pages.php i want to echo this after the post so i have:

    <?php
    echo $bgimage;
    ?>

    Any help would be great, thanks

  2. Add global $bgimage; in front of both of your uses of it.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.