Conditionals in functions.php
-
Anyone know how to get conditionals (like is_page_template) working in functions.php? I suppose this has something to do with the loop … and that WP doesn’t know the ID of the page? The first conditional below (post_id == ’24’) is working fine. The second one (is_page_template) is not. Any help would be greatly appreciated. Thanks.
Tom
function admin_init(){ $post_id = $_GET['post'] ? $_GET['post'] : $_POST['post_ID']; if ($post_id == '24') add_meta_box("lead_text", "Lead Text", "lead_text", "page", "normal", "high"); if (is_page_template('page_staff_bio.php')) add_meta_box("bio_excerpt", "Bio Excerpt", "bio_excerpt", "page", "normal", "high"); }
Viewing 12 replies - 1 through 12 (of 12 total)
Viewing 12 replies - 1 through 12 (of 12 total)
- The topic ‘Conditionals in functions.php’ is closed to new replies.