Forums

[resolved] If home page display specific title in h1 tags (2 posts)

  1. firehouse
    Member
    Posted 4 years ago #

    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    
    		<h1><?php the_title(); ?></h1>
    				<?php the_content(); ?>
    		<?php endwhile; endif; ?>

    I have no idea why this is stumping me, I know its easy. Since I want my navigation to say 'home' in my navigation tabs which is created dynamically....but I don't want the page to actually say something lame like "home". I want to hardcode something on the home page within the h1 tags, but only on the home page. I know I need to add a else if statement, but I can't figure out how to write that. Can someone lend me a hand?

    something like.. if is home then display <h1>special title here</h1> then display the post, if its not home then use the code from above...

    Thanks in advance to you php gurus. Or maybe I'm going about this all wrong.

  2. firehouse
    Member
    Posted 4 years ago #

    hacked away for a while loner, came up with this, right or wrong it seems to work while using a static page as my homepage. So maybe someone will find this useful.

    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    <h1><?php if (is_frontpage())echo"My Special title here"; else the_title(); ?></h1>
    <?php the_content(); ?>
    <?php endwhile; endif; ?>

Topic Closed

This topic has been closed to new replies.

About this Topic