How do I run a PHP script on my WordPress website?

by maxdosh 5 replies
I was looking for a plugin but then figured a php script on codecanyon can do what i want on my WordPress website but then i don't know a thing about php script and how to make it work on my WordPress website. Do i install it or something to have it function like wen i install a plugin in WordPress. Need help thanks
#programming #php #run #script #website #wordpress
Avatar of Unregistered
  • Profile picture of the author Michael Martin
    PHP is not a plugin it is a language and looks like this. sololearn are good to start
    {{ DiscussionBoard.errors[11081965].message }}
    • Profile picture of the author Michael Martin
      <?php

      $keyword_one = $result['keyword_one'];
      $keyword_two = $result['keyword_two'];
      $keyword_three = $result['keyword_three'];
      $keyword_four = $result['keyword_four'];
      $keyword_five = $result['keyword_five'];
      $keyword_multi = $result['keyword_multi'];



      $input = array($keyword_multi);
      $keyword = array_rand($input);

      // echo $input[$keyword]; $keyword_one, $keyword_two, $keyword_three, $keyword_four, $keyword_five
      ?>
      {{ DiscussionBoard.errors[11081966].message }}
  • Profile picture of the author sunoy14
    If you havent worked with programming language like php or havent coded in wordpress, you should probably just get a plugin.

    Otherwise you can add the php script with add_action hooks or add_shortcode inside functions.php. Or you may want to put the code inside a theme template file
    Signature

    "wordpress plugins" & "blogging tutorials" www.rom-link.com
    Free guitar lessons www.mamamusicians.com

    {{ DiscussionBoard.errors[11082017].message }}
  • Profile picture of the author divyakochar
    The php script needs to be executed on the wordpress to work. So either you can add the script to the page where you need it to work but adding any code which you don't have idea about can be harmful. So, you better take a hard look on that code and if that isn't malicious then you can add it to the page where it needs to be executed
    Signature
    {{ DiscussionBoard.errors[11094122].message }}
  • Profile picture of the author PhilHardaker
    Simplest solution:
    Install plugin "insert php" by Will Bontrager software.
    https://wordpress.org/plugins/insert-php/
    {{ DiscussionBoard.errors[11111856].message }}
Avatar of Unregistered

Trending Topics