Support » Requests and Feedback » Homepage Header Text

  • Hi there,
    Could someone please help me with the following?

    I would like to place some intro text and an image to appear above my posts on the hompage of my site ( I understand I need to use the is_home() tag, however I am unsure as to where this needs to be placed. My site has the following index.php




    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>

    <div class=”post”>
    <h3 class=”storytitle” id=”post-<?php the_ID(17); ?>”>” rel=”bookmark”><?php the_title(); ?></h3>
    <div class=”meta”><?php _e(“Filed under:”); ?> <?php the_category(‘,’) ?> — <?php the_author() ?> at <?php the_time(‘g:i a’) ?> on <?php the_time(‘l, F j, Y’) ?> <?php edit_post_link(__(‘Edit This’)); ?></div>

    <div class=”storycontent”>
    <?php the_content(__(‘(Read on …)’)); ?>

    <div class=”feedback”>
    <?php wp_link_pages(); ?>
    <?php comments_popup_link(__(‘Comments (0)’), __(‘Comments (1)’), __(‘Comments (%)’)); ?>

    <?php trackback_rdf(); ?>


    <?php comments_template(); ?>

    <?php endwhile; else: ?>
    <p><?php _e(‘Sorry, no posts matched your criteria.’); ?></p>
    <?php endif; ?>

    <?php posts_nav_link(‘ — ‘, __(‘« Previous Page’), __(‘Next Page »’)); ?>

    <?php get_footer(); ?>

    Any ideas?

Viewing 4 replies - 1 through 4 (of 4 total)
  • I really don’t have clue what you’d want to do, but the is_home() tag is normally used like this:
    if (is_home()){
    <!-- do stuff -->
    else {
    <!-- do other stuff -->

    The else part is not madatory though.

    Another thing, you’ve placed te is_home() tag in the loop of your index.php, normally you’d put it in header.php.

    Thanks for the tips!
    (Sorry if I sound muddled, I am very new to WordPress and am a beginner with code!)

    Just to clarify my need, I have some text that introduces the website i.e. ‘welcome to our website…etc’ and a supporting image. I just want this text and image appear on the homepage first and all recent posts to appear beneath the text.

    Am I correct to be using the is_home() tag to achieve this?

    Is there another way?

    No, the is_home tag is fine for this. Just put in your header.php, just before the <!-- end header --> code. Be sure to use the php tags, like this:
    <div id="content">
    <?php if (is_home()){ ?>
    <!-- Put your message here -->
    <?php } ?>

    Thanks for this.

    You pointed me in the right direction. However, I found that it worked for me by placing the code in index.php just before the WordPress loop. This is what I did for reference:

    <?php // Welcome Text
    if ( is_home()
    ) { ?>

    My intro text….

    <?php } ?>

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Homepage Header Text’ is closed to new replies.