• I would like a block of text under my header and above my posts to only appear on the homepage. Currently I have the text inserted in my templates index.php, so it appears on every page. How can I get the block of text to only appear on the homepage and nothing else? I am running WordPress 1.5.1 and FastTrack theme. My blog is located at https://www.zachkarst.com/wp. I have searched on Google and the WordPress forums but can’t find a solution to my problem. All I have found is a plugin that will make a full static homepage. All help would be greatly appreciated.

Viewing 15 replies - 1 through 15 (of 19 total)
  • Well, putting
    <?php if ( is_home() ) { ?> <?php } ?>
    around the block of text keeps it off of archives and things, but it’ll show on the subpages of main page

    Edit Oh yeah, using if (is_home() and !is_paged()) works by not showing the text on subpages, if you want that

    Thread Starter macguy22

    (@macguy22)

    Thank you for the code, I used it and it does keep the text off the archive pages. I still would like to have the block of text only appear on the homepage. If anyone else could help me out please post, so I can get this matter solved. I know everyone here is very knowledgeable so it won’t be too hard. Thank You.

    Did you try this <?php if ( is_home() and !is_paged() ) { ?> <?php } ?>?

    Or where is it showing where it’s not supposed to?

    Thread Starter macguy22

    (@macguy22)

    I just tried <?php if ( is_home() and !is_paged() ) { ?> <?php } ?>. It doesn’t work for me. The text is stil showing on my pages. It doesn’t show up in the archives, but the text shows up everywhere else.

    Try if(empty($_SERVER['QUERY_STRING']))

    Thread Starter macguy22

    (@macguy22)

    Where do I put if(empty($_SERVER[‘QUERY_STRING’]))?

    <?php if(empty($_SERVER['QUERY_STRING'])) { ?>

    <?php } ?>

    It replaces the if ( is_home() and !is_paged() )

    Thread Starter macguy22

    (@macguy22)

    The <?php if(empty($_SERVER[‘QUERY_STRING’])) { ?>

    <?php } ?> code does not work. The text is still showing up on my pages.

    Paste your index.php with the modification suggested above applied, here https://pastebin.com/.

    You might have done it wrongly.

    Do you have a separate page template (page.php)? Or are you doing everything with index.php?

    Thread Starter macguy22

    (@macguy22)

    I am doing everything with index.php. I do not have a seperate page.php file in my template.

    Well… I don’t know why the code keeps showing on pages, but what if you added and !is_page() to the list of is functions? I’m running out of ideas

    I’d follow alphaoide’s suggestion and post your source at the pastebin so we can take a look.

    Thread Starter macguy22

    (@macguy22)

    ok, sorry I didn’t see that post from alphaoide.

    EDIT: link to my code is https://pastebin.com/288120

    You need to put that intro text between the <?php if(empty($_SERVER['QUERY_STRING'])) { ?> and <?php } ?>.
    So the block of text goes where the word “and” is in the previous sentence ??

Viewing 15 replies - 1 through 15 (of 19 total)
  • The topic ‘Have Text Only Appear on Homepage’ is closed to new replies.