1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How to add php script on wordpress page/post?

Discussion in 'Blogging' started by Th3T3chGuy, May 21, 2012.

  1. Th3T3chGuy

    Th3T3chGuy Senior Member

    Joined:
    Jun 1, 2011
    Messages:
    889
    Likes Received:
    756
    Location:
    Behind You :)
    Hi, I just created a wordpress blog and I installed a random theme. I saw a php script from http://codecanyon.net that interested me. Is there anyway to make the php script run on that wordpress page only?

    Thanks
     
  2. maximviper

    maximviper BANNED BANNED

    Joined:
    Oct 25, 2010
    Messages:
    338
    Likes Received:
    86
    Yes . there are few plugin in wordpress which runs php .just goto 'install new plugin' and search for php. i dont remember the plugin name at the moment.
    I did this when i want to show the user's Ip address and the referral URL in the sidebar of my website.
     
  3. OriginalEXE

    OriginalEXE Power Member

    Joined:
    Feb 6, 2012
    Messages:
    634
    Likes Received:
    665
    Occupation:
    WordPress developer
    Home Page:
    Yes, of course:

    PHP:
    if (is_page'page-slug-of-your-page' )) {
    //your script
    }
    else {
    //normal page
    }
    or

    PHP:
    if (is_pageID OF THE PAGE )) {
    //your script
    }
    else {
    //normal page
    }
     
  4. Th3T3chGuy

    Th3T3chGuy Senior Member

    Joined:
    Jun 1, 2011
    Messages:
    889
    Likes Received:
    756
    Location:
    Behind You :)
    Ok thanks for the answers. But the script requires an index.php file and other files to be in my server.. I didn't actually get a php code.
     
  5. OriginalEXE

    OriginalEXE Power Member

    Joined:
    Feb 6, 2012
    Messages:
    634
    Likes Received:
    665
    Occupation:
    WordPress developer
    Home Page:
    what does a script do? Can you give url to the script?