Please Take a look at this screenshot: http://screencast.com/t/WtSrEOr8P
This cap of SEOZombie.com shows how the site owner is creating a dynamic H1 tag for his various blog posts/pages.
I'd like to have a similar setup on my blog. Here is a screencap: http://screencast.com/t/vx7TvT4xY
My idea is to put whatever targeted keywords for that page in a custom field entitled 'dynamich1" upon posting to the blog. From there I'd like to have a php call that checks to see if the "dynamich1" variable is there. If it is, it includes it there and wraps it in an h1 tag. If it is NOT there it pulls the post title and wraps it in an h1 instead.
So basically all I want this thing to do is "Check and see if there is a custom field named "dynamich1". If there IS, then diplay that here. If not, then display the post title here."
I don't know very much php and can only swipe bits and pieces from other themes to try to make it work. Here is what I tried to put in there, if no "dynamich1" was included in the post custom fields, it did properly display the blog title. But if that custom field WAS included, nothing showed.
I feel like I'm close, and that it's probably a small tweek? Possibly? Maybe. I hope.
Here's the code snippet I used:
Code: Select all
<?php if( get_post_meta($post->ID, "dynamich1", true) ): ?>
<h1 align="right"><a href="<?php echo get_post_meta($post->ID, "dynamich1", true); ?>/"></h1>
<?php else: ?>
<h1 align="right"><a href="<?php bloginfo('url'); ?>/"><?php bloginfo('name'); ?></a></h1>
<?php endif; ?>