如何阻止这两个wordpress功能相互干扰?

时间:2015-02-22 20:14:59

标签: php wordpress function plugins themes

我有一个特定的单词按主题和一个用于计算下载的插件....但是当我激活插件时,它使我所有的“精选缩略图”消失在我的wordpress中的所有帖子类型...换句话说那里在我激活插件后添加任何类型的帖子都没有“精选图像框”......

查看我的主题代码和插件代码后,我相信我已经找到了问题,但我不确定锄头来解决它......

我正在使用的主题具有以下功能

// 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”,“缩略图后”和其他一些类似的东西......不知道为什么这两个功能相互干扰或我如何解决它.... ..我试图将“dlm_download”帖子类型(这是插件的帖子类型)添加到帖子类型的主题函数数组中,它没有任何区别......

我试图从插件中完全删除缩略图功能并继续“无法调用标题:头已经调用”错误....

任何帮助都会非常感激!

1 个答案:

答案 0 :(得分:0)

尝试在主题中更改此行

add_theme_support( 'post-thumbnails', array( 'store', 'dlm_download', 'service', 'album', 'mixtape', 'merch', 'photos', 'video' , 'download' , 'homebanner', 'post' ) );

add_theme_support( 'post-thumbnails' );