• Resolved birdfan

    (@birdfan)


    I’m probably an idiot, but I want to code a welcome message into the main content section so it appears before the posts. Can someone tell me where in the index file it would go and how to code it so it will show up before the first post? Thanks

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hi – Put it before the loop, which usually starts as

    <?php if ( have_posts() ) :
             while ( have_posts() ) : the_post(); ?>

    Do a little trial and error until you find the place you are happy with.

    Thread Starter birdfan

    (@birdfan)

    Thanks, How do I code it so it appears? I tried to copy it before the loop and it didn’t appear on my site. Do I need to do some kind of <div> ?

    You don’t need a div, that’s just for styling. If you are not inside PHP tags (<?php ?>) then it should just pick up the text as HTML and display it.

    Can you post the top half of your code up to and including the

    <?php if ( have_posts() ) :
    while ( have_posts() ) : the_post(); ?>

    Also, are you using a static homepage?

    hi – If you want to experiment some more, you can try this

    <div id="welcome">
    <h3>Welcome to my site</h3>
    <p>Here are some things to know</p>
    <p>Here are some more</p>
    </h3>
    </div>
    <?php if ( have_posts() ) :
             while ( have_posts() ) : the_post(); ?>

    This shows where to put the code in relation to the loop. (i.e. above the loop)
    You can now style your block in the stylesheet by referring to
    #welcome for the whole block
    #welcome h3 for the headline
    #welcome p for the paragraphs

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How to code a paragraph into content section’ is closed to new replies.