A lot of web designers struggle with creating custom title tags and meta descriptions with PHP websites. This is a really easy fix to allow you to create custom meta information on your .php website:

1. First Add this little bit of code in your header.php file.
This example is based on your header file being named,”header.php”

<? if (isset($subtitle)) { echo $subtitle; } ?>

<meta name=”description” content=”<? if (isset($description)) { echo $description; } ?>”>

This code will allow you to create page specific meta titles and descriptions on your php website.
Below is a screenshot of how this looks in your actual file.

header.php custom title and description code


2. The Next Step is to add this code into your page document ie: index.php or about .php:

$subtitle = “Enter Your Custom Title Here”;
$description = “Enter Your Custom Description Here.”;

Just add the code shown above into your page document at the very top as the header.php call.

Here is a screenshot of what this looks like actually placed into your page document;

Page code for php page specific meta data