Get current page_id before loop, in functions.php
I’m pretty sure you try to use this conditional tags to early, so they don’t work. From Codex: Warning: You can only use conditional query tags after the posts_selection action hook in WordPress (the wp action hook is the first one through which you can use these conditionals). For themes, this means the conditional tag … Read more