WordPress.org

Forums

Hueman
[resolved] Best way to add a H1 tag to the Homepage? (4 posts)

  1. Francesco
    Member
    Posted 11 months ago #

    Hi guys, I'm wondering what's the best/smartest way to add a H1 title to the homepage only.

    I thought of 2 options:

    1) wrap the homepage title in <h1>
    or
    2) replace the first <h2> tag with <h1> by editing page-title.php

    <?php if ( is_home() ) : ?>
    		<h2><?php echo alx_blog_title(); ?></h2>

    What would you suggest?

    Cheers.

  2. Alexander Agnarson
    Member
    Theme Author

    Posted 11 months ago #

    Hi!

    The h1 on the homepage sits on the Custom Logo / Site Title, so there should be a H1 there (unless you use full header image).

  3. Francesco
    Member
    Posted 11 months ago #

    Thank you Alex.
    In fact, I use a header image - but I'm planning on replacing it with a header background and a custom logo.
    Cheers!

  4. HashtagMedia
    Member
    Posted 5 months ago #

    This is what I used to add a H1 (alt) to logo only on homepage:

    <a href="<?php echo home_url(); ?>/">
                        <?php if(is_home() || is_front_page()) { ?>
                        <h1><img src="LINKTOLOGO" alt="YOUR H1 TAG" /></h1>
                        <?php } else { ?>
                                <img src="LINKTOLOGO" alt="YOUR OTHER TAG" />
                        <?php } ?>
                        </a>

Reply

You must log in to post.

About this Theme

About this Topic

Tags