Warning: Trying to access array offset on false in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/wp.php on line 216
remove_theme_support() - 允许主题取消对某一功能的支持 - WordPress函数 - WordPress动力
当前浏览:首页 / WordPress函数 / remove_theme_support()

remove_theme_support( string $feature )

允许主题取消对某一功能的支持


Warning: Undefined array key -1 in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/reference-cat.php on line 185

Warning: Undefined array key 3 in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/reference-cat.php on line 186

Warning: Undefined variable $searchand in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/wp.php on line 154

Warning: Undefined array key "e3bd376c8a325cae20208df4f7e3936e" in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/wp.php on line 223

Warning: Undefined variable $searchand in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/wp.php on line 154

Warning: Undefined array key "bf54a07380c4a5252b20c594890f77be" in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/wp.php on line 223

Warning: Undefined variable $searchand in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/wp.php on line 154

Warning: Undefined array key "3a41fd57de8104db46dad2693d7f2deb" in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/wp.php on line 223

removemore...

support 支持

theme 主题more...


描述

应该在主题的 functions.php 文件中调用它。通常用于子主题以覆盖父主题的支持。

另见


参数

$feature

(string) (必填) 要删除的功能,有关可能值的列表,请参见add_theme_support()。


返回

(bool|void) 功能是否已删除。



源码

查看源码 官方文档


更新日志

版本描述
3.0.0开始引入

使用示例

  • 示例1

    删除子主题中的功能
    在某些情况下,父主题可能启用了您不想在子主题中使用的功能。例如,如果您使用的父主题已启用所有页面和文章的特色图像,但您希望删除在子主题中为页面提供特色图像的功能,则可以执行以下操作:

    // in your Child Theme's functions.php    
    
    // Use the after_setup_theme hook with a priority of 11 to load after the
    // parent theme, which will fire on the default priority of 10
    add_action( 'after_setup_theme', 'remove_featured_images_from_child_theme', 11 ); 
    
    function remove_featured_images_from_child_theme() {
    
        // This will remove support for post thumbnails on ALL Post Types
        remove_theme_support( 'post-thumbnails' );
    
        // Add this line in to re-enable support for just Posts
        add_theme_support( 'post-thumbnails', array( 'post' ) );
    }