Text on homepage only

Discussion in 'Blogging' started by MakeThatDollar, May 15, 2008.

  1. #1
    How can I have text show above the posts on the homepage only?

    I found the file to edit but I need the code that's like <?php if home() .... or something.

    Can someone help?
     
    MakeThatDollar, May 15, 2008 IP
  2. Joomla Dude

    Joomla Dude Banned

    Messages:
    592
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I dint get you what actually you are asking for..
    Can you please be more clear with an example?
    Then i would be able to help you. Thanks..
     
    Joomla Dude, May 15, 2008 IP
  3. MakeThatDollar

    MakeThatDollar Notable Member

    Messages:
    4,451
    Likes Received:
    158
    Best Answers:
    0
    Trophy Points:
    225
    #3
    On my homepage, I want to have an introduction that says like " welcome... blah blah blah " that will be displayed above the latest post. I know how to have the text displayed there. But the problem is, is that I only want that welcome text displayed when you are on index.php page. If you click on a sub-page or on a post, I don't want the welcome text shown.
     
    MakeThatDollar, May 15, 2008 IP
  4. themanbeast9

    themanbeast9 Active Member

    Messages:
    1,665
    Likes Received:
    68
    Best Answers:
    0
    Trophy Points:
    90
    #4
    Yeah, just go to your home.php file in your template and add whatever you want. It will only show on the homepage. I would probably include it above the content/post tag.
     
    themanbeast9, May 16, 2008 IP
  5. MakeThatDollar

    MakeThatDollar Notable Member

    Messages:
    4,451
    Likes Received:
    158
    Best Answers:
    0
    Trophy Points:
    225
    #5
    There is no home.php file in the theme I'm using.
     
    MakeThatDollar, May 16, 2008 IP
  6. MakeThatDollar

    MakeThatDollar Notable Member

    Messages:
    4,451
    Likes Received:
    158
    Best Answers:
    0
    Trophy Points:
    225
    #6
    Found what I needed. Here's how I did it:

    I added the following to header.php file within my theme:

    <?php /* If this is the frontpage */ if ( is_home() || is_page() ) { ?>
    TEXT TO SHOW
    <br><br>
    <?php } ?>
     
    MakeThatDollar, May 19, 2008 IP
  7. mizaks

    mizaks Well-Known Member

    Messages:
    2,066
    Likes Received:
    126
    Best Answers:
    0
    Trophy Points:
    135
    #7
    you don't want the "is_page()" portion as the text will show up on all your pages too.
     
    mizaks, May 19, 2008 IP
  8. Houdy

    Houdy Peon

    Messages:
    267
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Just add the text into the index.php file above this: <?php if (have_posts()) :?>
     
    Houdy, May 19, 2008 IP