On the Reading Settings page you can set a “Front Page” and a “Posts Page”. You can check whether the current page is_front_page();
Is there a similar function for the “Posts Page”. I have noticed that is_page();
does not work for this special page.
Thanks
is_home()
checks for the “Posts Page”, despite the somewhat confusing function name.WordPress comes with 7 primary template page types, which can be determined on this way
is_home tells to you, that you have the blog page.
“Posts page” is usually an archive of:
Each one of these can be checked by a one of the many conditional tags like
is_category()
is_tag()
is_date()
is_archive()
And so many more. To get a better understanding head over to the codex http://codex.wordpress.org/Conditional_Tags
First check the blogs related things like author, tag, post type
Now check and return something which you want to have
Use it like Boss
<?php echo check_post_type();?>
Thanks to Wes Bos
https://codex.wordpress.org/Conditional_Tags in WordPress Codex sais that you can reference pages like so:
TL;DR
Case A. There is no need to determine it inside the main template file (index.php) because it is the default template for it[1].
Case B. To determine it inside a page template (ex: page.php), simply check it like so:
Details
I literally went digging the source-code[2] of it just to be able to know how wordpress does the checking of the value. It turns out, it is using the statement
get_option( 'page_for_posts' )
to know the post ID of the selected value of the Posts page.So yeah, for this purpose, there is no such official checker function that is similar to
is_front_page()
.As long as you know the ID of the page that you’ve selected then you can use it for the checking process.
References
WordPress Codex, Theme Development, codex.wordpress.org/Theme_Development
Source-code of Settings ⺠Reading Settings, github.com/WordPress/…/wp-admin/options-reading.php