WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Adding a static welcome message before posts on 'home' page? (7 posts)

  1. theindiansabroad
    Member
    Posted 5 years ago #

    Could someone tell me what is the best way to achieve this. Right now, I have my home page display posts with newest on top, that is all good. What I want to try is adding a static message at the very top of the home page before the recent posts, and want it to stay at the top. One way I probably can do is by assigning the newest date to this message/post, so that it appears as the most recent post all the time, that means I will have to republish it every time with newer date when I add a post. Not the best thing to do I guess. Could you please guide me as to how I can accomplish this?
    Thanks.

  2. stvwlf
    Member
    Posted 5 years ago #

    if the message always stays the same, edit your theme's index.php file and add the message before the loop, using HTML

    <?php if (is_front_page()) { ?>
       <p>Display message here</p>
    <?php } ?>
  3. theindiansabroad
    Member
    Posted 5 years ago #

    Thanks.
    Could you please also tell me how can I call a long message to insert in your code above instead of 'display message here'. I have a full paragraph to display along with an image, just like a post.

  4. Mark / t31os
    Moderator
    Posted 5 years ago #

    Take the code provided, modify the text, follow the instructions provided.

    You've been given the solution, now all that's left is to follow it..

  5. theindiansabroad
    Member
    Posted 5 years ago #

    did you read my follow-up question?

  6. stvwlf
    Member
    Posted 5 years ago #

    Hi

    I just put three words of text in there. You are free to add 2,000 words if you need to. You can have multiple paragraphs, H2 and H3 tags, anything you want, including an image tag, in the space between the two lines of PHP code that presently says
    <p>Display message here</p>

    sorry i didn't make that clearer originally

    if you don't already know, the code for an image is - if you have the image in the theme's images folder:
    <img src="<?php bloginfo('template_directory'); ?>/images/myfilename.jpg" alt="" />
    Change the jpg filename of course

  7. theindiansabroad
    Member
    Posted 5 years ago #

    Thanks.

Topic Closed

This topic has been closed to new replies.

About this Topic