0

I am working on a website and I am using front-page.php from the 2012 theme as my front page. I set it up that way in settings and set a blank page as the blog in settings. So for the blog, it defaults to index.php which it should and it uses front-page.php as the front-page. My issue is that I have some breadcrumb code set up in the functions.php and there is a conditional in there that says " if not front page, then run code". My problem is that the conditional isn't allowing my code to run on the index page which would be the blog. What am I missing here? did I set it up wrong?

function the_breadcrumb() {
   if (!is_home()) {
    echo '<a class="breadcrumb" href="';
    echo get_option('home');
    echo '">';
    bloginfo('name');
    echo "</a> ";
    if (is_category() || is_single()) {
        the_category('title_li=');
        if (is_single()) {
            echo " &rarr; ";
            the_title();
        }
    } elseif (is_page()) {
        echo the_title();
    }
   }
 }

1 Answer 1

2

is_home() and is_front_page() can be a bit confusing, they're both true on the same page if your front page is the posts page, but in your case with a static front page, is_home() is true on your blog page, and is_front_page() is true on your static front page.

From Conditional Tags:

is_home(): When the main blog page is being displayed. This is the page which shows the time based blog content of your site, so if you've set a static Page for the Front Page (see below), then this will only be true on the Page which you set as the "Posts page" in Administration > Settings > Reading.

So if you want your link everywhere but the front page, change it to if( !is_front_page() )

1
  • I agree with you that is_home and is_front_page can be confusing. Thank you, that did the trick
    – Jamie
    Commented Jun 20, 2013 at 2:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.