obiwan77
Member
Posted 1 year ago #
for SEO, I want to optimize the theme so the site's title is used as the h1 tag ONLY on the homepage (actually =the front page if static page is displayed on the HP instead of the blog).
On posts and pages I want the post or page title to be the h1 tag
does anybody know how to write the php code to do this with the is_front_page() or is_home() elements?
help would be greatly appreciated.
cheers
look into twenty ten (header.php) for inspiration:
<?php $heading_tag = ( is_home() || is_front_page() ) ? 'h1' : 'div'; ?>
<<?php echo $heading_tag; ?> id="site-title">
<span>
<a href="<?php echo home_url( '/' ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a>
</span>
</<?php echo $heading_tag; ?>>
see if you can re-write this for just 'front_page' and 'h1/h2'