$this->add_meta_box('select_post_template', __('Post Template', 'custom-post-templates'), 'select_post_template', 'post', 'side', 'default');
要使插件与自定义帖子类型一起工作,我被告知将“帖子”更改为自定义帖子类型的名称。有谁知道我是否可以通过改变这条线以某种方式使它与全部定制的帖子类型(包括常规帖子)一起工作?提前 http://wordpress.org/extend/plugins/custom-post-template/如何包含所有自定义帖子类型而不是仅帖子
感谢:
仅供参考,我发现这个在: http://wordpress.org/support/topic/custom-post-templates-with-custom-post-types-in-wp-30?replies=5#post-1679398
而且这是在参考了自定义帖子模板插件!
编辑:
我已经试过:
$post_types = get_post_types(array("public" => true));
foreach ($post_types as $post_type) {
$this->add_meta_box("select_post_template", __("Post Template", "custom-post-templates"), "select_post_template", $post_type, "side", "default");
}
但自定义文章类型仍然没有得到模板选择菜单。这些帖子就像他们对原始代码所做的一样。感谢您的建议...有没有人有另一个?
注意:从概念上讲,该方法是可靠的。如果我使用自定义帖子类型的列表创建自己的数组,则此代码确实将模板添加到它们。
感谢您尝试,但它并没有扩展到自定义文章类型:( – Matrym 2010-09-09 20:14:59
我认为你的问题可能是您的自定义职位类型在自定义帖子模板插件被初始化之后被注册(因为它不使用钩子),所以'$ post_types'不包含你的帖子类型,并且不为它们添加元框。 – 2010-09-09 21:28:18