WordPress.org

Ready to get started?Download WordPress

Forums

Custom h1 tags on main page and category pages (11 posts)

  1. jtt89
    Member
    Posted 2 years ago #

    Is there any way to create custom <h1> tags for the main page and custom category pages, for SEO purposes?

    I was able to change that on single post pages (just making a post title an <h1>), but I would like to expand it to categories and the home page also (to include some keywords in the tags). It does not come with WordPress and it is an important thing for SEO that needs to be changed....

    Thank you.

  2. esmi
    Forum Moderator
    Posted 2 years ago #

    Yes - by editing the relevant templates files in your theme - single.php, category.php etc - and actually adding the H1 tags to the markup.

  3. jtt89
    Member
    Posted 2 years ago #

    I changed single.php already and this was easy, but when I looked at category.php it uses this code:

    <h2><?php the_category(); ?></h2>

    to repeat the category title on a page. I have about 20 categories (for this example, lets say named A - U) and I would like to display:

    "A" some ontehr words "A-related keyword" some other words. (instead of just A). I was trying to find a plugin for this, but I am not sure if something like that exists. It sounds like I would need to write another function or something like that, but maybe somebody was trying to do the same thing earlier and there is a solution to this.

  4. esmi
    Forum Moderator
    Posted 2 years ago #

    So you're trying to dynamically seed your titles with keywords? Why not construct your titles properly in the first place?

  5. jtt89
    Member
    Posted 2 years ago #

    I want to have main page and category pages (I have about 20). I use

    <title>
    <meta name="description"> (I use "All In One SEO Pack" plugin)

    <h1> (thats not available anywhere to customize, I can only change single.php and that takes care of that part only, main page and category pages are still missing custom h1 tags)

    <h2> (post titles, about 5-6 per page, about 300 words total; there might be only one <h1> tag per page so <h2> is the best solution for this)

    keywords, image-file-names, image-alt-tags etc...

    # # #

    Title would be different than <h1>, <h1> would be different than <h2> etc. But it is still one piece of equasion that is missing for SEO and it is important. I am not sure why there would be no solution for this. In the end I want to have every page displaying all the above mentioned elements, and I would want all of them to be different across all the pages (different title, h1, h2 post titles etc)

    Thank you in advance for any info

    # # #

    I think that a theme that I am working on was originally using <h3> as post titles and <h1> and <h2> tags were just not present...

  6. esmi
    Forum Moderator
    Posted 2 years ago #

    So change the H2 tags in your category.php template file to H1 and so on.

  7. jtt89
    Member
    Posted 2 years ago #

    When I do that it displays:

    <h1>Category name exactly as it is called</h1>

    instead of:

    <h1>My custom name that is different for the main page and each category page that I am using</h1>

    Categort names are already based on keywords and they are part of the main navigation, so this is gonna get spidered and indcludent in the index. I just want to have that (one level down) custom <h1> tag underneath it to make it perfect for SEO. In the current scenario it is gonna be

    Page title
    Category name
    <h1>Category name</h1> instad of <h1> Some more keywords not repeated exactly like they are in Category name</h1>

    # # # #

    It is more like having 20 different pages (not posts) with different, hard coded <h1> tags, but this is dynamically generated with php and this is causing a problem. I think I would need to look into adding some custom function somewhere etc (I never done it but it sound like a solution to this)

  8. jtt89
    Member
    Posted 2 years ago #

    The solution to what I am trying to do is simple. There is a "Description" field in Category menu, where I can just enter what I want and then I just need to add the wollowing code to category.php

    <h1><?php echo category_description( $category_id ); ?></h1>

    Some themes are suppose to include it by default, some dont, but this is exactly what I was trying to do...

    Thank you.

  9. esmi
    Forum Moderator
    Posted 2 years ago #

    That makes no logical or hierarchical sense. Your category title should be the H1 and the description an H2 (if you absolutely insist on using heading tags).

  10. jtt89
    Member
    Posted 2 years ago #

    I dont want that this way because category title becomes category page <title> and I dont want to repeat the same word again. I want to use it in <h1> but in a different context.

    This is gonna be my first website and I dont want to overdo anything and get penalized for something right from the start etc. I want to start slow, get a feel of how things go and then possibly start adding more keywords etc. I dont want to be getting too many links either (I heard it is better to go 15 - first month, 30 - second, 45-60 third etc...)

    If something does not look natural or gets repeated too often it may negatively affect rankings...

    # # # #

    I am still gonna have more related (and the same) keywords in <h2>, text, image names, image alt tags, wordpress tags etc... I dont want it to look like too many keywords...

  11. esmi
    Forum Moderator
    Posted 2 years ago #

    This is gonna be my first website and I dont want to overdo anything and get penalized for something right from the start etc.

    Then you should be aware that heading tags are supposed to be in a logical order.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.