Timeline for Why isn't is_page working when I put it in the functions.php file?
Current License: CC BY-SA 3.0
7 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Apr 17, 2015 at 8:17 | comment | added | Rarst | @reggie why not? You should probably ask new question about it. :) | |
Apr 17, 2015 at 8:16 | comment | added | reggie | What if you want to add a filter to the query? You can't do that in the template. But you can't do it in the functions.php file, either! | |
Aug 10, 2011 at 0:45 | vote | accept | Wordpressor | ||
Jun 29, 2011 at 10:42 | comment | added | Rarst | @Martin quotes are not entirely correct, but won't break anything either - it is loosely compared by default (without checking if type matches) | |
Jun 29, 2011 at 9:09 | comment | added | MartinJJ |
I dont use id's for page reference but codex shows that the id of the page has no single quotes, have you tried that? is_page(); // When any single Page is being displayed. is_page(42); // When Page 42 (ID) is being displayed. is_page('Contact'); // When the Page with a post_title of "Contact" is being displayed. is_page('about-me'); // When the Page with a post_name (slug) of "about-me" is being displayed. is_page(array(42,'about-me','Contact')); // Returns true when the Pages displayed is either post ID 42. probably not the case but worth a shot
|
|
Jun 29, 2011 at 9:01 | comment | added | Wordpressor | I've tried with this code inside of a function as well, but seems like it returns nothing. I know putting it all into page.php should help, but is not so elegant. | |
Jun 29, 2011 at 8:41 | history | answered | Rarst | CC BY-SA 3.0 |