Best way to Append Page Template <Title> Dynamically
I have a database driven template in my website and would like to add an item name to the beginning of the page title.
Would it be better to try to add and concatenate the page title and title tag or can I just replace the info sent to with a custom string? Atahualpa Code PHP Code:
My Thoughts PHP Code:
Thanks a ton for your help! |
the page title is built in the code bfa_meta_tags.php. You would have to edit that code and put your title override in there and remember to save the change and redo it each upgrade
you might try searching for a plugin. |
Is there anyway to do this at the template level? I want to change the template, not how all titles are processed.
|
The issue is that the templates call get_header() which runs header.php which builds the begining of the page and that calls the code in bfa_meta_tags.php where the actual <title....> is built. So, no you can't do it in the template as far as I can see.
You'll have to put in logic to check the page I'd to then do what you want. |
Thank you for the clarification. There was an article I saw today that spoke about how Google uses the first instance of a <title> if there are more than one. So I implemented a gimpy work around to see what happens in the index.
So I am placing this code in front of the generation. PHP Code:
Right now the pages are not indexed and I suspect it is because they appear to be duplicate content to Google. If this works to get them indexed by having an accurate <title> in lieu of a code error (2 <title> with one out of the <head>) I can work with that. However, I am not sure yet what kind of unforeseen issues this might cause in this template. |
What about the option of removing get_header(); and then manually building it for this page on the template? What kind of horrors would I unleash on the theme and plugins if I did that?
I appreciate the help as I learn how all of these theme pieces work together. |
the best way to learn is to try it.
|
All times are GMT -6. The time now is 08:39 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.