This is not a question but rather a brief explanation of a problem I had and how other noobs like me can work around it. It probably isn’t the best or most elegant solution, but numerous Google and wordpress.org searches were fruitless, so I figure somebody will benefit from this at some time. I hope you will leave a comment if you know of a better solution or you have any other thoughts.
I have a sidebar with both internal and external links, and I much prefer to keep the text of the links short, even when the title of the page is much longer. For instance, I have a page of my favorite quotations, and the link in the sidebar just says “Quotes”, but the title that I put at the top of the Quotes Page is “John’s quotes collection.” (To make the text displayed in the sidebar link and the text displayed at the top of the page be different, I followed this guide: http://www.wordpressmax.com/wordpress-guide/remove-wordpress-page-title.)
However, the page title that you insert on your own at the top of your page, using H1 or H2 tags or whatever to make it big and bold and colorful, is not the same title that is displayed in the browser’s title bar. The code that specifies the title that’s displayed in the browser’s title bar is in the [title] tag of the header.php document. If you want to change that title, you have to modify the [title] tag somehow. But you don’t want to modify header.php to make one little old page display a different title than you gave it during the Page creation process. I thought creating a second header document, with my preferred, non-dynamic title setting, would be the solution. It wasn’t, but most of the following steps were part of the eventual solution, so read on.
First you have to make a new Page template (http://codex.wordpress.org/Pages#Creating_Your_Own_Page_Templates) and give it a name that isn’t already taken. It’s probably most convenient for noobs like me to copy and paste the contents of page.php and then modify that. You’ll notice that, right below the name of the Page template, there’s the get_header command. At first I thought: All I need to do is create a new header document, say, header2.php, make it identical to header.php except for replacing the PHP code in the [title] tags with the specific page title that I wanted, then replace “get_header” with “get_header2” in my new Page template document, and choose this new template from the “Template” dropdown menu in the Edit Page area.
Except WordPress only understands certain “get” and “do” commands. If I could figure out how to make WordPress understand “get_header2” just as well as it understands “get_header”, this would have worked like a charm. But it doesn’t. So how do you tell your new Page template to get the same header that is displayed atop every other page of your website but to also display in the browser title bar the specific title that you want this specific page to have?
Well, simply delete the PHP tag that contained the “get_header” command, and paste the entirety of your alternate header right there in the new Page template PHP file! Instead of being directed to an alternate header file, the page with this new template will simply load all of the alternate-header code on its own! This accomplished exactly what I was going for, and I don’t see any downsides.
Are there any drawbacks or better solutions to this seemingly simple problem? (It isn’t a very complicated solution, but I wanted to be as detailed and explicit as possible, which made this post quite long.)
So how do you tell your new Page template to get the same header that is displayed atop every other page of your website but to also display in the browser title bar the specific title that you want this specific page to have?