well, here’s a starter for everyone:
http://codex.ww.wp.xz.cn/Function_Reference/add_meta_box
I need to add_meta_box to my custom post_type menu. I’m just going to need to know the $callback and the $callback_args I think. If anyone has any ideas it would be helpful
It’s going to need an add around lines 104-106 of wp-customer-reviews-admin.php where it adds the meta box. It’s adding ot the ‘page’ on 105 and the ‘post’ on line 106.
/* add for pages and posts */
add_meta_box($meta_box['id'], $meta_box['title'], array(&$this, 'wpcr_show_meta_box'), 'page', $meta_box['context'], $meta_box['priority']);
add_meta_box($meta_box['id'], $meta_box['title'], array(&$this, 'wpcr_show_meta_box'), 'post', $meta_box['context'], $meta_box['priority']);
I’m not sure what is “best practice” for adding something into someone else’s plugin so that I don’t make it harder on myself later down the road. Any ideas? It works if I just duplicate the ‘post’ line and insert my custom post_type. But, i’m not sure if I’ll remember that down the road.
A change maybe to line 49 where it assigns ‘page’ => ‘page’ and make it this=>post_type or something like that. I’m a rather big noob, so i’m grabbin at straws here.
Thanks,
Hi Jerry, thanks for your message, appreciate the nudge
I’ll give this a go!
Thanks
Nick
I am also new to this, but a more flexible option I tried was to get all custom post types automatically like this:
wp-customer-reviews-admin.php
After line 107
/* add for custom post types */
$post_types=get_post_types('','names');
foreach ($post_types as $post_type ) {
add_meta_box($meta_box['id'], $meta_box['title'], array(&$this, 'wpcr_show_meta_box'), $post_type, $meta_box['context'], $meta_box['priority']);
}
/* END add for custom pst types */
Obviously this is not great if the Plugin code changes.
2 shortcodes have been added, that -SHOULD- work for custom post types.
1 for displaying reviews only (for use in a sidebar, homepage, etc) and 1 for displaying the current page’s reviews and the review form. The codes should be able to be placed anywhere you want on any page.
Any issues, please let me know. No styling has been done for showing reviews on any page, so for now you may need to roll your own CSS for that into your theme. An update to that may come later once everyone approves that it is working correctly for them.