Daniel –
thanks for the tip ?? And sorry for taking so long in responding – been a busy couple of months.
I’ve tried what you suggested, and it does work – to a point. I can get it to work as you’ve stated above – but things are out of order. I don’t know if I can explain it correctly, but I’ll give it a shot.
To Daniel (and onyone else who might have an inkling as to what’s happening!), what I want is to have the header.php file contain the variables to be called in. In other words, the header.php file contains my doctype and title, keywords, etc. tags, like any normal website does. However, I want the title, keywords and description tags to be PHP variables so that I can designate the content of those variables from each page.
So, to do this, I have to split the above example code up. If I put the above in the header.php file, then the same title, keywords and description show up for every page on the site. This is not what I want – I want to define the variables on each page so they are all different.
If I place the example above on my index.php file (and the other pages I want this to work on), the meta tags show up in the source code *before* the header does.
So I’m at a loss as how to split it up properly. I had thought that having the variables *before* the get_header() command in the index file would work – the variable definitions show up before the request in the header – but it seems because they are separate files, the variables don’t recognize their definitions.
If that’s not clear enough, basically it’s like this. My header.php file starts out like this:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"https://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="https://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Aneko Studios - <?php echo $title; ?></title>
<meta name="description" content="<?php echo $description; ?>" />
<meta name="keywords" content="<?php echo $keywords; ?>" />
Then, in the index.php file, I place the variable definitions *above* the get_header() call, like so:
<?php
$title = "extended title here";
$description = "description here";
$keywords = "keywords here";
get_header();
?>
I would like to put the above definitions in the index.php file (to designate the “blog” area) and also on all of my Pages, to designate what Page has different keywords and such.
So, in essence, the first thing the browser *should* see when calling up the page are the variables and their definitions – then it should call in the header of the page, and place the definitions in the proper places within the meta tags.
But it’s not – it’s getting the header file all right – but it’s completely ignoring the variable definitions, and for the life of me, I can’t figure out why.