ThemeShaper Forums » Thematic

[closed]

footer link on home page only

(9 posts)
  • Started 8 years ago by lastraw
  • Latest reply from lastraw
  • This topic is resolved
  1. Hi all,

    I want to add a site link to the footer on the homepage only, in addition to the info in the thematic footer admin set up for all the pages, but what I have isn't working

    <?php
    //WD link on frontpage only
    
    function my_footer($thm_footertext) {
    if (is_front_page() )
    	$thm_footertext .= '<a href="http://www.windesheimdesign.com" target="_blank"> || site by Windesheim Design</a>. ';
    	return $thm_footertext;
    }
    add_filter('thematic_footertext', 'my_footer');
    
    ?>

    could someone take a look? It's probably something obvious :)

    Thanks,
    Leslie

    Posted 8 years ago #
  2. You pulled a "tarpontech" and forgot the brackets for your if statement.

    function my_footer($thm_footertext) {
    if (is_front_page() ) {
    	$thm_footertext .= '<a href="http://www.windesheimdesign.com" target="_blank"> || site by Windesheim Design</a>. ';
    	return $thm_footertext;
    	}
    }
    add_filter('thematic_footertext', 'my_footer');
    Posted 8 years ago #
  3. Thanks tarpontech,

    It's even worse, I didn't even know you were supposed to have those brackets! I put them in but now nothing displays in the footer, so I must of done something else wrong too. Can you give it another look?

    the site is this one again http://www.integralgroup.com/ (with the IE fixed up)

    Posted 8 years ago #
  4. Hi all,

    @Leslie The code you first posted was correct in terms of syntax. I think maybe you have the wrong conditional logic set. Try

    is_home()

    or try

    is_home() || is_front_page()

    @tarpontech as a basic matter of syntax what Leslie first presented was correct. There are many different way to code a conditional statement the way you presented using brackets was fine but it doesn't return any value if the condition is not TRUE. Moving the return out of the conditional is necessary to output the footer text on other parts of the site.

    if (is_front_page() ) {
    	$thm_footertext .= '<a href="http://www.windesheimdesign.com" target="_blank"> || site by Windesheim Design</a>. ';
    	}
    return $thm_footertext;
    }
    add_filter('thematic_footertext', 'my_footer');
    Posted 8 years ago #
  5. Thanks, it worked!

    Posted 8 years ago #
  6. Thank you Gene. If I had bothered to look at the result of my code, i would have seen that, while it displayed the desired output on my front page, you were right, and no footer text appeared on subsequent pages. Cut-n-paste for the loss...

    Sorry Leslie!

    To take this a step farther, using the is_home and/or is_front_page conditional tags are a tricky beast, and depends on your site's setup.

    If your site is set up as a "standard" blog, wherein the front page is displaying posts as it's using index.php as its template, is_home, or better yet is_home() || is_front_page() is ideal.

    But if you are using a static front page, especially a static front page you've set up via the admin menu's reading settings, you'll have to specify it as is_front_page, as wordpress is looking for is_home to be the "blog" page. I think i'm missing a few nuggets in there...but, hopefully that gets the point across...in a weak attempt to make up for my Doh!

    Posted 8 years ago #
  7. Im glad it all worked out.

    For more info try looking here:

    http://www.php.net/manual/en/control-structures.if.php

    Posted 8 years ago #
  8. thanks alot Gene, now my eyes are all blurred out from reading all that if statement stuff.

    Anyways, hey leslie, since i happened to have your site's address from your code snippet i got nosey and looked at the site.

    I REALLY like what you guys did with the contact page. Very cool way of mixing an image with html.

    Posted 8 years ago #
  9. I thought I knew about the is_home() vs. is_front_page() issue from looking it up on the codex—so I assumed it was some other thing I did wrong. Thanks Gene, you saved me a lot of time.

    And tarpontech I think we would all rather have someone's best guess then no response, it usually leads to the answer in the end. And thanks i.e. windesheimdesign.com contact page. Don't tell anyone but I got that shot by tossing one of our mailing labels in the dog's water bowl!

    Posted 8 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.