Google Groups

Re: How to add the field to custom post types?


Dominic Apr 27, 2011 9:30 PM
Posted in group: yak-discuss
Add this to your functions.php

*shop_products* refers to whatever you named your custom-post-type
when you created it.

Or, you can see the full code at my never-used blog:
http://blog.dominicwhittle.com/yak-ecommerce-and-custom-post-types/
It also includes creating a custom post type specifically for this
purpose (with it's own categories) and a bit of magic that hides the
default Yak category thats used for product variations (so your
categories don't get clogged up with "small-red", "medium-blue" and so
on).



// used in the custom post type "register_meta_box_cb" callback to
add
yak
function custom_yak_meta_box() {
        add_meta_box('yak','YAK Product
Details','yak_editproduct','shop_products','advanced'); // !!!
}

// Remove yak box from posts and pages
function remove_yak_meta_box() {
    remove_meta_box('yak','post','advanced');
    remove_meta_box('yak','page','advanced');
}

add_action('admin_menu', 'remove_yak_meta_box');