Timeline for How to get the original post_id of a static home page?
Current License: CC BY-SA 3.0
14 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Oct 6, 2011 at 20:38 | vote | accept | JVC | ||
Oct 6, 2011 at 19:38 | comment | added | JVC | Sorry, still one remaining problem: is_front_page() is returning true, for BOTH the posts page AND the front page. So I'm unable to check for one or the other. Does it only work within certain hooks? EDIT: Just found this... sounds like I may be out of luck with this approach! nspeaks.com/1069/difference-between-is_home-and-is_front_page | |
Oct 6, 2011 at 19:32 | vote | accept | JVC | ||
Oct 6, 2011 at 19:36 | |||||
Oct 6, 2011 at 19:32 | comment | added | JVC | OK WTF... suddenly it's working in 'wp' and I have no idea why. sooo... I think I have what I needed, thanks Michael for all your answers! | |
Oct 6, 2011 at 19:23 | comment | added | JVC | No neither works at all, that seems to be the final issue. I know they only work after the 'init' hook, and I have them firing in 'wp' so I expect that they should work... right? | |
Oct 6, 2011 at 19:19 | comment | added | Michael |
where are you using the code? does is_home() or is_front_page() work as expected?
|
|
Oct 6, 2011 at 19:17 | comment | added | JVC | But both are in fact set. The problem is the is_home and is_front_page checks, both are failing. The get_option works fine without those checks. | |
Oct 6, 2011 at 19:13 | comment | added | Michael |
if neither is set in 'settings -> reading' both get_option() return nothing. where exactly have you used the code?
|
|
Oct 6, 2011 at 19:11 | comment | added | JVC |
Yep thanks, I had JUST figured this out a few minutes ago. Unfortunately neither is returning anything for some strange reason: if(is_home()){ $postid = get_option( 'page_for_posts' ); }elseif(is_front_page()){ $postid = get_option('page_on_front'); } $postid comes up empty every time. Any idea why?
|
|
Oct 6, 2011 at 19:10 | comment | added | Michael | afaik, you didn't ask for the static front page id - now edited into my answer. | |
Oct 6, 2011 at 19:09 | history | edited | Michael | CC BY-SA 3.0 |
added front-page id code
|
Oct 6, 2011 at 19:02 | comment | added | JVC | Oops, I stand somewhat corrected as I misunderstood. This DOES return the original post_id of the posts page, which is half the battle! But it does not return the original post_id of the home page. So thank you very much for this, I just need this one last piece... anyone know how to get the original post_id of the home page? | |
Oct 6, 2011 at 18:15 | comment | added | JVC | Thanks but this isn't at all related to my question. I need to know how to get the original post_id of the home/posts page, not to tell if it IS the home/posts page in the first place. | |
Oct 6, 2011 at 8:42 | history | answered | Michael | CC BY-SA 3.0 |