Support » Fixing WordPress » Trouble with is_home

  • Resolved AaronPowell

    (@aaronpowell)


    I’m trying to get a block of text to show up in the sidebar only on the site’s front page. The trouble is, it’s showing up on the home page and all archive pages, too. Here’s what I have right now.

    <?php if(is_home()) { ?>
    <div class="widget">
    
    	<h2 class="hl">Only on Home Page</h2>
    
    </div><!--/widget-->
    <?php  } ?>

    I also tried the suggestion to use

    if (is_home() && !is_paged())

    with the same result.

    Does anyone have any idea what’s causing this problem?

    Thank you.

Viewing 9 replies - 1 through 9 (of 9 total)
  • Do you have a Page set as the home page in your settings (static front page)?

    If so, then you need to use is_front_page(), not is_home().

    Nope, it’s set to “Your latest posts.”

    Ok, the url linked to your profile is a spam…

    What are the “all archive pages“?

    Well, you say you’re trying to get the text to show up on the site’s front page, but it’s showing up on the home page (which is why I asked about page settings – you made it sound like you have a static front page as the home page – so I just want to clarify that blog posts *are* the home page). So it *is* showing up on the page you want it to then, right? So your issue is it’s showing up everywhere else then too?

    Are you using a query on the home page? Are you using widgets? is that piece of code before (or after) the widget code in your sidebar.php file, or within the widget call?

    moshu, I’m not sure what you mean by “Ok, the url linked to your profile is a spam…” Can you tell me what url you’re talking about?

    doodlebee, it is showing up on the home page, but it’s also showing up on the monthly archives, tag archives, etc. It’s not showing up on single post pages.

    The code is in sidebar.php. I don’t think it’s inside of any widget code.

    http://www.symbolicorder.com/
    It shows a for sale link and some spam links, nothing else. That’s what I get when clicking on your name here.

    Ah, yep, that’s makes sense. That used to be my site and then the url expired quite a long time ago and got snatched up by a domain squatter. I forgot it was still set in my profile. I’ve changed it.

    it is showing up on the home page, but it's also showing up on the monthly archives, tag archives, etc. It's not showing up on single post pages.

    That tells me that your single post pages are using different sidebar code – that perhaps your sidebar call is NOT in the sidebar.php file. Unless you aren’t using a sidebar in your single.php file.

    It would help a TON if we knew what theme you were using, or we could see the index.php and sidebar.php files (DON’T post them here – go to pastebin and give us the stuff to look at) – right now we’re shooting int he dark. More information would be helpful rather than just guessing.

    Still not sure what was causing the problem. The theme is “Live Wire” (http://www.woothemes.com/2008/03/live-wire/) for what it’s worth. But I managed to just circumvent the wordpress issues entirely by checking the url manually with if($_SERVER[“SCRIPT_URI”]. That seems to have fixed it. Thank you for the help.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Trouble with is_home’ is closed to new replies.