vafour / vafpress-framework

Wordpress theme options framework, check out the demo.
http://demo.vafpress.com/vafpress-framework
Other
240 stars 98 forks source link

Can we make metaboxes displaying only on a specific page template? #90

Open aonzzung opened 9 years ago

aonzzung commented 9 years ago

Hi,

First, thanks for sleek framework. I'm interested in integrating it into my themes.

However, I checked the demo http://demo.vafpress.com/ and http://vafpress.com/documentation/vafpress-framework but I found metaboxes showing only on standard WP posts only.

Is there any tutorial how to create metaboxes for specific (custom) page templates and custom post types ?

Thanks

web-caos commented 9 years ago

For custom post types you have just to specify your CPT in the metabox array, example:

return array( 'id' => 'vp_meta_id', 'types' => array('book'), // You can specify your CPT here 'title' => __('VP Example Metabox', 'vp_textdomain'),

For specific pages is a bit more tricky, personally i create the metaboxes just for "page" and then show/hide them with jQuery accordly to the page template selector in the edit page.