Opened 9 years ago
Last modified 6 years ago
#34487 new enhancement
Add a new conditional tag for the "Posts Page"
Reported by: | roytanck | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 4.4 |
Component: | General | Keywords: | has-patch |
Focuses: | Cc: |
Description
Currently, there's no conditional tag to determine whether the current page is the "Posts Page", set under Settings->Reading. The codex (https://codex.wordpress.org/Conditional_Tags#The_Blog_Page) describes a way to combine is_home() and is_front_page(), but I propose that we instead add a new conditional tag to deal with this.
Naming the function is a little tricky. Unfortunately, the name "is_posts_page" is taken in query.php, so I created a patch that adds "is_blog_page". It returns true on the "posts page", and false everywhere else.
I've run across this issue in real world projects a couple of times and though it would be a good addition to WordPress. The patch adds this to query.php because is_home() and is_front_page also live there.
Patch that adds the is_blog_page conditional tag to query.php