Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are the different ways to detect home page in wordpress?

What are the different ways to detect wordpress homepage

except is_front_page() and is_home()

Thanks

like image 419
Tushar Ahirrao Avatar asked Feb 07 '11 11:02

Tushar Ahirrao


People also ask

How do I find my home page in WordPress?

To get there, log in to WordPress.com and go to My Site. In the lefthand menu bar click on the option that says “Customize.” It varies slightly from theme to theme, but you should look for an option that say somthing like “Homepage Settings.” This page will tell you which page the site is using as a homepage.

What is the home page called in WordPress?

Your front page is the homepage of your WordPress site. By default, it displays your blog posts, starting with the most recent entries. WordPress enables you to set the number of posts displayed and even include teasers for other posts (depending on your theme's options).

What is the difference between home page and front page?

A front page and a home page is the same thing. It's the page people see if they click your site's URL instead of the URL for a specific post/page. Your site is currently set to display latest posts on the front page.

How do I create a homepage in WordPress?

WordPress allows you to easily use any page on your website as your homepage. You can simply go to Pages » Add New page inside WordPress admin area to create a new page. Let's give this page a title 'Home' and publish it. You will use this page as your custom homepage.


1 Answers

is_front_page() is what you want.

I assume, by the fact that is_home() is not working, that your home page is static, according to the settings in wp-admin.

is_home() returns true on your main blog page whereas is_front_page() returns true on which ever page is defined as your front page, feed or not.

From codex:

This Conditional Tag checks if the main page is a posts or a Page. This is a boolean function, meaning it returns either TRUE or FALSE. It returns TRUE when the main blog page is being displayed and the Settings->Reading->Front page displays is set to "Your latest posts", or when is set to "A static page" and the "Front Page" value is the current Page being displayed.

like image 58
Mild Fuzz Avatar answered Nov 02 '22 22:11

Mild Fuzz