WPTemplate.com

WordPress PHP Tutorial for Beginners

Let us start by understanding what PHP is and how it will help you enhance your blogs on WordPress.  A bunch of HTML is sent from the server when a webpage is viewed.  Whatever be your browser, Internet Explorer, Firefox or any other, PHP transforms this HTML into the attractive things that you see in it. In HTML, every one viewing a website will be seeing the same items.

PHP Tutorial

For example, if the content on a HTML page is

<p> Today is February 18th, 2013 <p>

All visitors on this site will see the following:

Today is February 18,2013

even though this may not be that date. So what do you do when you wish to adjust or modify such that the current date is shown always? Now, that’s the function of PHP. Your server processes PHP and sends it to the page after evaluating the PHP content. When you write the following on your webpage:

WP PhP Tutorial

<p>Today is <?php echo date(\'F jS, Y\'); ?><⁄p>

The PHP expression will be changed to the present date which will then be sent as HTML to the browser. The rest is taken care of by the browser. Do note that PHP produced HTML is what gets send to the browser and not PHP itself. Since HTML and PHP are different languages, you must open the PHP code on your server with <?php and end using ?>. This can be done as many times as required in the document. The correct syntax for PHP must be used between <?php and?>.

Consider this example:

$myVar1 = \'How are you?\';     ⁄⁄  these slashes imply that the all within the line is a statement

$myVar2 = \'Well, you?\';    ⁄* indicates more than a line,

Use PHP to do brighten up WordPress, including adding icons on your website.

Leave a Reply

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

16 + ten =

Time limit is exhausted. Please reload the CAPTCHA.

1000's of Wordpress Templates at Great Prices: Visit ThemeForest