WordPress.org

Forums

[resolved] php if code (3 posts)

  1. jrcollins
    Member
    Posted 1 year ago #

    I'm trying to show the date on the front page of my website using the following code:

    <?php if(is_front_page()) ?>
      <p id="update"><?php the_date('M d Y'); ?></p>
    <?php endif ?>

    but I'm getting an "unexpected t_endif" error.
    Can someone who knows what they're doing tell me what I'm doing wrong?

  2. Andrew
    Nuh uh moderator
    Posted 1 year ago #

  3. jrcollins
    Member
    Posted 1 year ago #

    Hi, thanks for the link. That worked! I changed it to the following:

    <?php if(is_front_page()): ?>
    <p id="update"><?php the_date('M d Y'); ?></p><?php endif; ?>

Topic Closed

This topic has been closed to new replies.

About this Topic