What I want to do is… on a per page/post basis I want to be able to have the H1 say something different then the Title…
This should be such a simple thing, but I’ve been looking around for an option and searching google for a solution for an hour now, and I can’t find anything.
Is there a way to do this in WordPress without hacking the code?
Or if not, what is a clean way to do this with code that will not get overwritten when I update WordPress?
p.s. im using the Dynamik/Geneisis theme.
Yes! Custom fields: http://codex.wordpress.org/Custom_Fields
You can create alternate post titles via the post editor, and then you can display them with some minor adjustments to the
single.php
andindex.php
templates (or{$post_type}-archive.php
templates, if you have them). For example:Alex Denning has a great introduction on Smashing Magazine here: http://wp.smashingmagazine.com/2010/04/29/extend-wordpress-with-custom-fields/
EDIT
If you’d like to make this update-proof, I would suggest making a handy little plugin. For something to try, take the code below and replace “YOUR_CUSTOM_FIELD_HERE” with your custom field, and then it will filter the template tag
the_title();
to replace it with that field (if not filled in, returns the post title). I haven’t tested this code, but it should work:To try it out, take the code and give it a name (say,
custom-title.php
) and drop it in your site’swp-content/plugins
folder and activate it. Let me know if it works out!Another easy way of doing it is installing Yoast’s SEO plugin. There you can specify an “SEO title” for each post which is the Title Tag, and then you can name the post a different thing, which would be the H1 tag in most themes.