WordPress.org

Ready to get started?Download WordPress

Forums

it possible to make post title to get h1 tag (2 posts)

  1. fridha
    Member
    Posted 4 years ago #

    Hi,
    i have make a little change for tagging in this theme for better SEO,

    but, it seems not work, i want in my blog Posting the Post-Title become <h1> tag and Blog-Title become <h2> tag.
    For the Blog Homepage, i want it normal (Blog-Title <h1> and Post-Title <h2>).

    This is my change on header.php
    Before:
    <h1><a href="<?php bloginfo('url'); ?>" title="<?php bloginfo('name'); ?>"><?php bloginfo('name'); ?></a></h1>
    After:

    <?php if(is_single() OR is_page()) {
    // On single post pages and static pages we use this code
    ?>
    <h1><a href="<?php bloginfo('url'); ?>" title="<?php bloginfo('name'); ?>"><?php bloginfo('name'); ?></a></h1>
    <?php }
    else {
    // On home page and archive style pages we use this code
    ?>
    <h2><a href="<?php bloginfo('url'); ?>" title="<?php bloginfo('name'); ?>"><?php bloginfo('name'); ?></a></h2>
    <?php } ?>

    This is for post.php
    <h1 class="post-title"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link: <?php the_title(); ?>"><?php the_title(); ?></a></h1>

    Thanks

  2. mostever
    Member
    Posted 4 years ago #

    I know nothing about php. With that said, it seems if you could serve different headers to different pages you could select h1 blog title for home and h2 blog title for post pages. Makes sense to me, but then again I don't know anything about this.

    You have seen my post where I am trying to fix an h-tag problem myself.

Topic Closed

This topic has been closed to new replies.

About this Topic