Support » Fixing WordPress » If Statemement for Home Page

  • I want to add a little if statement to my main index page that basically says:

    if this is the home page add a little text div above the main loop. This paragragh wil be a small introduction to my site.

    the php for the start of my page is a little more cryptic than the stuff I’m used to working with.. I tried this…

    <?php if(is_home() echo ‘Welcome to my site..blah..blah..blah’;}?>

    but no dice…

    the top of my page looks like this:

    <?php
    get_header();
    ?>

    <div id=”content”>
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    <div class=”entry <?php if(is_home() && $post==$posts[0] && !is_paged()) echo ‘ firstpost’;?>”>

    <h3 class=”entrytitle” id=”post-<?php the_ID(); ?>”> ” rel=”bookmark”>
    <?php the_title(); ?>
    </h3>
    <div class=”entrymeta”>
    <?php the_time(‘F dS, Y’);
    echo ” | Category: “;the_category(‘,’);?>
    </div>
    <div class=”entrybody”>
    <?php the_content(__(‘Read more’));?>

  • The topic ‘If Statemement for Home Page’ is closed to new replies.