我怎样才能阻止这两个 wordpress 功能相互干扰?
how can i stop these 2 wordpress functions from interfering with each other?
我有一个特定的 word press 主题和一个用于计算下载量的插件....但是当我激活该插件时,它使我所有的 "featured thumbnails" 消失在我的 wordpress 中的所有 post 类型...换句话说,在我激活插件后添加任何类型的 post 时没有 "featured image box" ......
在查看了我的主题代码和插件代码后,我相信我已经找到了问题,但我不确定是否要修复它......
我使用的主题具有以下功能
// Add Thumbnail support
if (function_exists('add_theme_support')) { // Adding thumbnail support to all post types.
add_theme_support( 'post-thumbnails', array( 'store', 'dlm_download', 'service', 'album', 'mixtape', 'merch', 'photos', 'video' , 'download' , 'homebanner', 'post' ) );
add_image_size('storeimage', 200, 200, true); //Store homepage Thumbnails
add_image_size('beat_page', 160, 160, true); // Single beat page
add_image_size('photo', 200, 200, true); // Thumbnail image
add_image_size('photowidget', 165, 165, true); // Thumbnail image
add_image_size('videowidget', 270, 151, true); // Thumbnail image
add_image_size('photobig', 570, 570, true); // Image for single page
add_image_size('videoimage', 273, 200, true); // Video Gallery Homepage Thumbnails
add_image_size('homebannerimage', 920, 350, true); //Homepage Banner Image
add_image_size('featuredimage', 580, 250, true); //Post Featured image Image 580x250
}
然后插件有如下功能
public function compatibility() {
// Post thumbnail support
if ( ! current_theme_supports( 'post-thumbnails' ) ) {
add_theme_support( 'post-thumbnails' );
remove_post_type_support( 'post', 'thumbnail' );
remove_post_type_support( 'page', 'thumbnail' );
} else {
// Get current supported
$current_support = get_theme_support( 'post-thumbnails' );
// This can be a bool or array. If array we merge our post type in, if bool ignore because it's like a global theme setting.
if ( is_array( $current_support ) ) {
add_theme_support( 'post-thumbnails', array_merge( $current_support, array( 'dlm_download' ) ) );
}
add_post_type_support( 'download', 'thumbnail' );
}
}
我注意到他们都使用 "add_theme_support" , "post-thumbnails" 和其他一些类似的东西......不知道为什么这两个功能相互干扰或者我如何解决它......我试图将 "dlm_download" post 类型(这是插件的 post 类型)添加到 post 类型的主题函数数组中,并且它没有任何区别.....
我试图从插件中完全删除缩略图功能并不断收到 "failed to call header : head already called" 错误....
任何帮助将不胜感激!
尝试更改主题中的这一行
add_theme_support( 'post-thumbnails', array( 'store', 'dlm_download', 'service', 'album', 'mixtape', 'merch', 'photos', 'video' , 'download' , 'homebanner', 'post' ) );
至
add_theme_support( 'post-thumbnails' );
我有一个特定的 word press 主题和一个用于计算下载量的插件....但是当我激活该插件时,它使我所有的 "featured thumbnails" 消失在我的 wordpress 中的所有 post 类型...换句话说,在我激活插件后添加任何类型的 post 时没有 "featured image box" ......
在查看了我的主题代码和插件代码后,我相信我已经找到了问题,但我不确定是否要修复它......
我使用的主题具有以下功能
// Add Thumbnail support
if (function_exists('add_theme_support')) { // Adding thumbnail support to all post types.
add_theme_support( 'post-thumbnails', array( 'store', 'dlm_download', 'service', 'album', 'mixtape', 'merch', 'photos', 'video' , 'download' , 'homebanner', 'post' ) );
add_image_size('storeimage', 200, 200, true); //Store homepage Thumbnails
add_image_size('beat_page', 160, 160, true); // Single beat page
add_image_size('photo', 200, 200, true); // Thumbnail image
add_image_size('photowidget', 165, 165, true); // Thumbnail image
add_image_size('videowidget', 270, 151, true); // Thumbnail image
add_image_size('photobig', 570, 570, true); // Image for single page
add_image_size('videoimage', 273, 200, true); // Video Gallery Homepage Thumbnails
add_image_size('homebannerimage', 920, 350, true); //Homepage Banner Image
add_image_size('featuredimage', 580, 250, true); //Post Featured image Image 580x250
}
然后插件有如下功能
public function compatibility() {
// Post thumbnail support
if ( ! current_theme_supports( 'post-thumbnails' ) ) {
add_theme_support( 'post-thumbnails' );
remove_post_type_support( 'post', 'thumbnail' );
remove_post_type_support( 'page', 'thumbnail' );
} else {
// Get current supported
$current_support = get_theme_support( 'post-thumbnails' );
// This can be a bool or array. If array we merge our post type in, if bool ignore because it's like a global theme setting.
if ( is_array( $current_support ) ) {
add_theme_support( 'post-thumbnails', array_merge( $current_support, array( 'dlm_download' ) ) );
}
add_post_type_support( 'download', 'thumbnail' );
}
}
我注意到他们都使用 "add_theme_support" , "post-thumbnails" 和其他一些类似的东西......不知道为什么这两个功能相互干扰或者我如何解决它......我试图将 "dlm_download" post 类型(这是插件的 post 类型)添加到 post 类型的主题函数数组中,并且它没有任何区别.....
我试图从插件中完全删除缩略图功能并不断收到 "failed to call header : head already called" 错误....
任何帮助将不胜感激!
尝试更改主题中的这一行
add_theme_support( 'post-thumbnails', array( 'store', 'dlm_download', 'service', 'album', 'mixtape', 'merch', 'photos', 'video' , 'download' , 'homebanner', 'post' ) );
至
add_theme_support( 'post-thumbnails' );