Genesis Tutorials

What is Php Code?

WordPress PHPWordPress uses php code to display web pages dynamically and enable different functions to work on your blog. PHP stands for  Hypertext Preprocessor.

Php code is a bit like html with php tags making it possible for your web pages to function in different ways.

If you understand the basics of html tags then you’ll be able to learn the basics of php coding even though its a different language.

Php is abit like html in a way with special opening (start) and closing (end) tags. Your php files on your server will end in a .php extension therefore your server will treat them as php rather than html or css as your server comes installed with a php module that processes .php file extensions.

When you host a file with the .php extension on your server, the php processor installed on your Linux server will parse the file which results in an output depending on the function the php code has been written to do.


  <title>PHP Test</title>
 <?php echo '<p>wordpress php</p>'; ?>

The special opening and closing php tags are <? and ?>

Unlike CSS & HTML, PHP needs to be hosted externally in a .php file on a server which should  be Linux rather than a Windows server which hosts (Microsoft’s competitor to PHP-Open Source) to work so you cannot write or paste php code inline (in your Visual or HTML editor).

The latest version of WordPress now uses the latest version of PHP 5 so your web host will also need to provide support for this.

Caution: If you make a mistake in your code while modifying a PHP file, saving the file may result in your site becoming temporarily unusable. Prior to editing such files, be sure to have access to the file via FTP or other File Manager so that you can fix the error. Best practice dictates its always best to complete a full backup of your files before editing PHP code.

Here’s a list of ALL php function categories and one example of each

  • Array functions – array()
  • Calendar functions – JDDayOfWeek() Returns the day of a week
  • Date functions – date_default_timezone_set() Sets the default time zone (The behavior of the date/time functions is affected by settings in php.ini.)
  • Directory functions – chdir() Changes the current directory
  • Error functions – error_get_last() Gets the last error occurred
  • Filesystem functions – filesize() Returns the file size (The behavior of the filesystem functions is affected by settings in php.ini.)
  • Filter functions – FILTER_VALIDATE_EMAIL Validate value as e-mail
  • FTP functions – ftp_connect() Opens an FTP connection
  • HTTP functions – setcookie() Sends an HTTP cookie to a client
  • LibXML functions – libxml_get_last_error() Retrieve last error from libxml
  • Mail functions – mail()Allows you to send emails directly from a script (For the mail functions to be available, PHP requires an installed and working email system. The program to be used is defined by the configuration settings in the php.ini file.)
  • Math functions – max() Returns the number with the highest value of two specified numbers
  • Misc functions – connection_aborted() Checks whether the client has disconnected (The behavior of the misc functions is affected by settings in the php.ini file.)
  • MySQL functions – mysql_get_host_info() Returns MySQL host info (The behavior of the MySQL functions is affected by settings in the php.ini file.)
  • SimpleXML functions – simplexml_load_file() Gets a SimpleXMLElement object from an XML document
  • String functions – ucfirst() Converts the first character of a string to uppercase
  • XML Parser functions – xml_parse() Parses an XML document
  • Zip functions – zip_open()Opens a ZIP file (Installation on Linux Systems: PHP 5+: Zip functions and the Zip library is not enabled by default and must be downloaded from the links above.)

You can learn more about how to write php for free at W3 Schools. Or you can use custom made php code for free if you own a premium theme.

One of the benefits of owning a premium WordPress theme like Thesis is the custom file editor which makes it easy to add php code too and make custom changes to your blog.

Thesis also offer a great list of free php code already written so its a simple copy and paste job into your Thesis php editor and your done.

Coding doesn’t get any easier or hassle free than this. Also, if you ever get stuck or need technical support, Thesis are the only Theme creator who actually pay full time experts to provide round the clock support to Thesis owners. Check out Thesis here.

More PHP Code Resources

  1. WordPress Memory-How To Increase PHP Allowed Memory Limits
  2. Php Scripts – A List Of The Best Php Scripts as an Alternative To Plugins
  3. How To Add HTML 5 Code Support to The Thesis Theme for WordPress
  4. How To Create Previous & Next Page Links
  5. How To Add a Second WordPress Navigation Menu In Thesis Using Custom PHP Script

One reply on “What is Php Code?”

Leave a Reply

Your email address will not be published. Required fields are marked *