本文整理汇总了PHP中_remove_theme_support函数的典型用法代码示例。如果您正苦于以下问题:PHP _remove_theme_support函数的具体用法?PHP _remove_theme_support怎么用?PHP _remove_theme_support使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了_remove_theme_support函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: unregister_nav_menu
/**
* Unregisters a navigation menu for a theme.
*
* @param array $location the menu location identifier
*
* @return bool True on success, false on failure.
*/
function unregister_nav_menu($location)
{
global $_wp_registered_nav_menus;
if (is_array($_wp_registered_nav_menus) && isset($_wp_registered_nav_menus[$location])) {
unset($_wp_registered_nav_menus[$location]);
if (empty($_wp_registered_nav_menus)) {
_remove_theme_support('menus');
}
return true;
}
return false;
}
示例2: afterSetupTheme
/**
* Sets up theme defaults and registers support for various WordPress features.
*
* Note that this function is hooked into the after_setup_theme hook, which
* runs before the init hook. The init hook is too late for some features, such
* as indicating support for post thumbnails.
*/
public function afterSetupTheme()
{
/*
* Load language for text domain from /lang dir
*/
load_theme_textdomain('DIRESS_DOMAIN', TEMPLATE_DIR . '/lang');
// Add default posts and comments RSS feed links to head.
add_theme_support('automatic-feed-links');
/*
* Let WordPress manage the document title.
* By adding theme support, we declare that this theme does not use a
* hard-coded <title> tag in the document head, and expect WordPress to
* provide it for us.
*/
add_theme_support('title-tag');
/*
* Enable support for Post Thumbnails on posts and pages.
*
* @link https://developer.wordpress.org/themes/functionality/featured-images-post-thumbnails/
*/
add_theme_support('post-thumbnails');
_remove_theme_support('menus');
}
示例3: remove_theme_support
/**
* Allows a theme to de-register its support of a certain feature
*
* Should be called in the theme's functions.php file. Generally would
* be used for child themes to override support from the parent theme.
*
* @since 3.0.0
* @see add_theme_support()
* @param string $feature the feature being added
* @return bool Whether feature was removed.
*/
function remove_theme_support($feature)
{
// Blacklist: for internal registrations not used directly by themes.
if (in_array($feature, array('editor-style', 'widgets', 'menus'))) {
return false;
}
return _remove_theme_support($feature);
}
示例4: test_supports_menus
/**
* @ticket 26900
*/
function test_supports_menus()
{
// Start fresh
foreach (get_registered_nav_menus() as $location => $desc) {
unregister_nav_menu($location);
}
_remove_theme_support('menus');
$this->assertFalse(current_theme_supports('menus'));
// Registering a nav menu automatically adds support.
register_nav_menu('primary', 'Primary Navigation');
register_nav_menu('secondary', 'Secondary Navigation');
$this->assertTrue(current_theme_supports('menus'));
// Support added internally, can't be removed.
remove_theme_support('menus');
$this->assertTrue(current_theme_supports('menus'));
// Still supports because of secondary.
unregister_nav_menu('primary');
$this->assertTrue(current_theme_supports('menus'));
// No longer support because we have no menus.
unregister_nav_menu('secondary');
$this->assertEmpty(get_registered_nav_menus());
$this->assertFalse(current_theme_supports('menus'));
}