I am playing with dynamic header titles, descriptions and canonical.
I am having some trouble explaining and figuring out what is going on here.
I am copying the exact same sample as below into my existing live website, but for some reason on my live website it does not replace the strings as it does in the testing sample?
Is there anything that can disturb the outcome of the script?
Testing
<html lang="da">
<head>
<!-- Title -->
<title>%TITLE%</title>
<!-- META -->
<meta name="description" content="%DESCRIPTION%">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link rel="canonical" href="%CANONICAL%"/>
<!-- GOOGLE+ -->
<meta itemprop="name" content="TITLE">
<meta itemprop="description" content="This is the page description">
<meta itemprop="image" content="http://www.example.com/image.jpg">
</head>
<body id="body">
<p>Hello</p>
<?php
$buffer = ob_get_contents();
ob_end_clean();
$canonical = "https://www.shittysite.com";
$placeholders = array("%CANONICAL%");
$substitues = array($canonical);
$buffer = str_replace($placeholders, $substitues, $buffer);
echo $buffer;
?>
</body>
</html>