Ok so i have a head.php file that i am including to some of my pages that have the same heads. However i am at a loss on how to get page specific things like the title tag, facebook’s open graph, and other things required for SEO, inside the head without writing it all out. Is there a variable for that?
This reply has been reported for inappropriate content.
There’s a few ways you can do this, either by breaking up your head.php into, for example, doctype.php (where you put, doctype and meta charset etc). Then call that on your page.
Then have your title tags on each page.
Then have head.php full of the stuff after that.
Alternatively, what I do is pass a variable, usually to the body class, but it will work in the case of title tags too.
For example, when you call your file at the top of each file/page, create a line above with a variable.
Then in your head.php have;
It will grab the variable from the document and then echo it out inside your title.
I also do this for body classes (if needed) where I do;
The above basically sets the default body class if there isn’t one passed through, but if there is, it echo’s it out.