Tuesday, 26 November 2013

Add a Header Code and Get Different Meta tags on Each web Pages

Copy this code in header.php file above!

<?php
function curPageURL() {
 $pageURL = '';
 if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}

 if ($_SERVER["SERVER_PORT"] != "80") {
  $pageURL .= $_SERVER["REQUEST_URI"];
 } else {
  $pageURL .= $_SERVER["REQUEST_URI"];
 }
 return $pageURL;
}

$count='';
$expld_code=explode('/',curPageURL());


$count=count($expld_code)-1;

?>


COPY this code in header.php file in <head> section


<?php if($expld_code[$count]=='web page name') { ?>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>ABC</title>
<meta name="description" content="" />
<meta name="keywords" content="" />
<?php   }  ?>