user1223844
user1223844

Reputation: 87

How do I exclude some code on posts and pages in wordpress?

I have a feature box on my header.php file, because of this the feature box gets displayed in every page and post page as well. What code do I need to keep this feature box only in the homepage and no place else?

Upvotes: 0

Views: 33

Answers (1)

rnevius
rnevius

Reputation: 27092

You're looking for the is_front_page() function:

if ( is_front_page() ) {
    // Show the feature box
} else {
    // Do something else
}

Upvotes: 1

Related Questions