Support » Themes and Templates » Only display date on homepage

  • Resolved jbj101

    (@jbj101)


    Currently, I am using the Travelogue theme and it displays the date next to each post on every page. I only want it to display the date next to posts on the home page. I have tried using the is_home() condition without success. Any help would be greatly appreciated. I’m sure this is very simple and I am just missing something stupid. Thanks.

    [moderated: snip]
    <div class="post">
    <div class="post_cal">
    <?php $postraw = the_date('D, j, M, y', '', '', FALSE);
    $postdate = explode(', ', $postraw); ?>
    <div class="dayname"><?php echo $postdate[0]; ?></div>
    <div class="daynum"><?php echo $postdate[1]; ?></div>
    <div class="month"><?php echo $postdate[2]; ?> '<?php echo $postdate[3]; ?></div>

    <div class="year"></div>
    </div>

    [moderated: snip]

Viewing 6 replies - 1 through 6 (of 6 total)
  • Does this theme have a single.php as part of it?

    unfortunately, no.

    Hmm… ok, so after
    <div class="post">

    add

    <?php if (is_home()) { ?>

    and it looks like after
    <div class="year"></div>
    </div>

    add
    <?php } ?>

    Try that?

    Or, copy index.php to single.php and remove that date code.

    works!!! i’m new to php and was totally using the wrong syntax. thanks so much for your help!

    glad it worked. Go ahead and mark this thread as “resolved” please?

    And happy blogging!

    You should also be able to copy single.php from the default theme into your theme folder and have it work more “normally”.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Only display date on homepage’ is closed to new replies.