WordPress.org

Ready to get started?Download WordPress

Forums

How to make a static welcome message at the top of the frontpage (3 posts)

  1. nielshansen
    Member
    Posted 8 years ago #

    I would like to have a static welcome message at the top of my blogs frontpage. Like a static entery at the top of the page or something like that. Is it possible? How?

    Niels

  2. Mark (podz)
    Support Maven
    Posted 8 years ago #

    One way is to put something before The Loop.

    The top of your main index.php will be something like this:
    <?php
    get_header();
    ?>
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>

    so putting some thing between those will effectively look like a sticky / message:

    <?php
    get_header();
    ?>
    <div id="message">
    Hi, this is a welcome message
    </div>
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>

    and then in the css:
    #message {
    width:300px;
    margin: 0 auto;
    border: 2px solid #ff0000;
    background-color:#ccc;
    color:#00ff00;
    }

    should get somewhere close ?

  3. jaredquinn
    Member
    Posted 8 years ago #

    If you only want it on the front page add:

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

    around the div.

Topic Closed

This topic has been closed to new replies.

About this Topic