Custom H1 Tags Using Custom Fields in WordPress

One of the most common ways to show H1 tags on every page in WordPress is by wrapping the function the_title() in H1 tags, like so:

But if you would like to have a more flexible system where you can create custom headings to improve SEO or whatever reason it may be, the simplest way to accomplish that is by creating a custom field specific for H1 tags.

Adding the “head1” custom field to your template file

The H1 tag can be usually found in the beginning of the main loop, but this varies on different themes. Place this code on your template file wherever you want your H1 tag to appear.

Note the conditional statement that checks if there is a custom H1; if there isn’t one, it will display the default page name.

Creating the “head1” custom field in WordPress

1. Open the page you wish add the custom field in “edit” mode. Make sure the custom fields option is checked under screen options.

Wp Admin Screen Options

2. In the custom field meta box, add a new “head1” custom field. This will be your custom H1.

Wp Admin Custom Fields

That’s it! Preview the page and you should now see your custom H1.

Posted in WordPress

Ready to get started?

Get a Free Estimate