I am trying to dynamically change my page titles. I have the following script inside my header.php page
<?php $pagetitle = "Website Home"; ?>
<head>
<title><?php echo $pagetitle ?></title>
</head>
But instead of my page title displaying as “Website Home”, the page title shows up as “<?php echo $pagetitle ?>“. Is there a reason why the php will not execute inside the <title> tags?
you’re calling your header.php some unusual way. Just
includeit in other php script.