I am using Wordpress latest version and I this piece of code inside my header.php:
<?php
$url = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
$slugMenu = array (
'planes',
'two-wings',
'four-wings'
);
if (in_array($url, $slugMenu)) {
echo "
<style>
.planes,
.two-wings,
.four-wings { background:#101010; }
</style>
";
}
else {
echo _("not found");
}
?>
The code output should be like this:
- Check to see if the URL contains one of the elements in declared array
- If it does, then echo inside the properties and values
Well, for some reason, just doesn't work. All I get is else " not found" instead of actually having the <style>
inside the <head>
.
The thing is that it was working on another project of mine based on same Wordpress. Am I doing something wrong here?