Add metabox to a "Page" that uses a specific template
-
I was wondering if anybody knows how to add a custom meta box to a “page” that uses a specific template. I don’t need help creating the metabox or anything like that. I just want to be able to specify that if a “page” is using the template home-page.php that the custom meta box then show up on the back end. I found this post http://www.farinspace.com/page-specific-wordpress-meta-box/ and tried the code:
$template_file = get_post_meta($post_id,'_wp_page_template',TRUE); // check for a template type if ($template_file == 'home-page.php') { add_meta_box("faq_meta", "FAQ Options", "faq_meta", "page", "normal", "low"); }
But that didn’t seem to work. Removing the if statement, I am able to get my custom metabox to show up, but it shows up on all pages then.
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Add metabox to a "Page" that uses a specific template’ is closed to new replies.