Support » Fixing WordPress » footer: only show a line when on home.php

  • Resolved ladydelaluna


    Okay, I’ve checked the forums and the codex, and came up with something like this:

    <?php if (is_home()) { ?>
    <br /><a href="">Link Text</a>
    <?php } ?>

    To put in the footer, so that this only shows up when the visitor is on the home page (which is home.php)

    But… it’s not working.

    I’m trying to make it so that MY link shows up in the footer only on that home page (it’s the web dev credit link) and not across the whole site…

    I’ve searched the codex, read the conditional tags page, gone to PHP tutorial sites, and I’m lost…

    What am I missing?

Viewing 15 replies - 1 through 15 (of 17 total)
  • I use the following which works and also one for is_home():

    <?php if ( is_single() ) : ?>
    <ul class="menublock">
    <li><?php previous_post('%','&laquo; Previous Page', 'no'); ?></li>
    <li><?php next_post('%','Next Page &raquo;', 'no'); ?></li>
    <?php endif // is_single() ?>

    Okay, but I don’t want it to show up on EVERY “single” page… I only want it to show up on the home page.

    There are TONS of pages on the site using single.php… I’m talking about ONLY having this on home.php, which overrides index.php…

    Other than that, the content between the php tags really means nothing – yours appears to be for a sidebar navigation and mine is a hard coded link…

    Reminder – this is going in the footer.php file… not the sidebar.

    I use the same construct with the is_home() function.

    Okay, but how is that different than what I posted that I have used that isn’t working then?

    edit – i changed my start and end to yours, and nothing’s showing up.

    I now have this in there:

    <?php if ( is_home() ) : ?>
    <a href="" target="_blank">Link Text</a>
    <?php endif // is_home() ?>

    … not working, at all – I don’t see this anywhere…

    I just tried the following and it works for me:

    <?php if ( is_home() ) : ?>
    <br /><a href="">Link Text</a>
    <?php endif // is_home() ?>

    This is what you have. What theme are you using?

    It’s a HEAVILY modified theme… I’m quite sure that nothing out there would resemble it anymore… LOL

    We’ve got custom queries and a million modifications.

    Essentially, the structures we’re using are home.php, single.php, page.php, archive.php footer.php, and two conditional use sidebars that only show up here and there around the site…

    Maybe you have it a a block of code that is overwritten by something after it. Just a thought, since I can’t actually see your code.

    here’s the entire piece of code for my footer – as it sits right now…

    <!--<div class="clearingdiv">&nbsp;</div>-->

    <div id="footer">
    One line of company information, name, phone, address, etc.

    <?php if ( is_home() ) : ?>
    <a href="" target="_blank">Link Text</a>
    <?php endif // is_home() ?>
    </div> <!-- ishome|issingle|isarchive -->



    Incidentally – the one line of company information shows up perfectly fine…
    it’s MY info that’s not showing up at all anywhere…

    And if you use

    <?php if ( is_home() ) echo “< a href=\”\” target=\”_blank\”>Link Text”; ?>

    Did you try a hard refrsh Ctrl-F5 to clear the cache?

    I switched it to your code, Stefan – still nothing. 🙁

    That’s the only way I do refresh when I’m making code changes…

    show the result of is_home is it 1/true on every page?

    echo is_home();

    Try putting <p></p> around your ‘one line of company info’ and see if that makes a difference.

    All the p tags did was change the horizontal alignment to the left instead of the right… (I tried that with both of your codes)

    Stefan – I’m not sure what you mean… can you please clarify that last post?

Viewing 15 replies - 1 through 15 (of 17 total)
  • The topic ‘footer: only show a line when on home.php’ is closed to new replies.