本文整理汇总了PHP中WP_Theme::parent方法的典型用法代码示例。如果您正苦于以下问题:PHP WP_Theme::parent方法的具体用法?PHP WP_Theme::parent怎么用?PHP WP_Theme::parent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WP_Theme
的用法示例。
在下文中一共展示了WP_Theme::parent方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setup_theme
/**
* Loads cookie and sets up theme filters.
*/
public static function setup_theme()
{
global $pagenow;
if (is_admin() && 'themes.php' == $pagenow || !self::can_switch_themes()) {
return;
}
self::check_reset();
self::load_cookie();
if (empty(self::$theme)) {
return;
}
add_filter('pre_option_template', array(self::$theme, 'get_template'));
add_filter('pre_option_stylesheet', array(self::$theme, 'get_stylesheet'));
add_filter('pre_option_stylesheet_root', array(self::$theme, 'get_theme_root'));
$parent = self::$theme->parent();
add_filter('pre_option_template_root', array(empty($parent) ? self::$theme : $parent, 'get_theme_root'));
add_filter('pre_option_current_theme', '__return_false');
}
示例2: isValidTheme
/**
* @param WP_Theme $theme
*
* @return bool
*/
public function isValidTheme(WP_Theme $theme)
{
return $this->checkCapability() && $theme->exists() && !$theme->parent();
}
示例3: is_child
/**
* Check, the current theme have a parent value and is a child theme.
*
* @param array|\WP_Theme $theme_data An array of theme data.
*
* @return bool
*/
public function is_child(\WP_Theme $theme_data)
{
return (bool) $theme_data->parent();
}
示例4: loadConfigs
/**
* Loads recursively the config file from a theme and its parents
*
* @param $theme WP_Theme Current theme
* @return array
*/
private function loadConfigs(\WP_Theme $theme)
{
if (false !== $theme->parent()) {
$this->loadConfigs($theme->parent());
}
$theme_dir = $theme->get_stylesheet_directory();
$path = "{$theme_dir}/config/" . $this->name;
if (is_dir($path)) {
$this->loadDir($path, $theme);
}
if (is_file("{$path}.yml")) {
$this->loadFile("{$path}.yml", $theme);
}
}