Last active
February 17, 2021 00:26
-
-
Save frankyonnetti/6d1bb339084c6b10a1d9fefc93384376 to your computer and use it in GitHub Desktop.
WordPress - if blog list page #wordpress #list
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * https://codex.wordpress.org/Conditional_Tags#The_Blog_Page | |
| * There is no conditional tag for the blog list page. You have to use | |
| * both `is_home()` and `is_front_page()` to detect this page. You also | |
| * have to use them in the right order to avoid bugs and to test every | |
| * user configuration. | |
| */ | |
| if (is_front_page() && is_home()) { | |
| echo 'default homepage'; // default homepage | |
| } elseif (is_front_page()) { | |
| echo 'static homepage'; // static homepage | |
| } elseif (is_home()) { | |
| echo 'blog list page'; // blog list page | |
| } else { | |
| echo 'everything else'; // everything else | |
| } | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment