本文整理汇总了PHP中wc_get_core_supported_themes函数的典型用法代码示例。如果您正苦于以下问题:PHP wc_get_core_supported_themes函数的具体用法?PHP wc_get_core_supported_themes怎么用?PHP wc_get_core_supported_themes使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wc_get_core_supported_themes函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: add_notices
/**
* Add notices + styles if needed.
*/
public function add_notices()
{
if (get_option('_wc_needs_update') == 1 || get_option('_wc_needs_pages') == 1) {
wp_enqueue_style('woocommerce-activation', plugins_url('/assets/css/activation.css', WC_PLUGIN_FILE));
add_action('admin_notices', array($this, 'install_notice'));
}
$notices = get_option('woocommerce_admin_notices', array());
if (!empty($_GET['hide_theme_support_notice'])) {
$notices = array_diff($notices, array('theme_support'));
update_option('woocommerce_admin_notices', $notices);
}
if (!empty($_GET['hide_template_files_notice'])) {
$notices = array_diff($notices, array('template_files'));
update_option('woocommerce_admin_notices', $notices);
}
if (in_array('theme_support', $notices) && !current_theme_supports('woocommerce')) {
$template = get_option('template');
if (!in_array($template, wc_get_core_supported_themes())) {
wp_enqueue_style('woocommerce-activation', plugins_url('/assets/css/activation.css', WC_PLUGIN_FILE));
add_action('admin_notices', array($this, 'theme_check_notice'));
}
}
if (in_array('template_files', $notices)) {
wp_enqueue_style('woocommerce-activation', plugins_url('/assets/css/activation.css', WC_PLUGIN_FILE));
add_action('admin_notices', array($this, 'template_file_check_notice'));
}
if (in_array('translation_upgrade', $notices)) {
wp_enqueue_style('woocommerce-activation', plugins_url('/assets/css/activation.css', WC_PLUGIN_FILE));
add_action('admin_notices', array($this, 'translation_upgrade_notice'));
}
if (!class_exists('WC_Mijireh_Checkout') && ($mijireh = get_option('woocommerce_mijireh_checkout_settings', false)) && !empty($mijireh['enabled']) && $mijireh['enabled'] === 'yes' && empty($_GET['action'])) {
add_action('admin_notices', array($this, 'mijireh_notice'));
}
}
示例2: reset_admin_notices
/**
* Reset notices for themes when switched or a new version of WC is installed
*/
public function reset_admin_notices()
{
if ($this->has_frontend_colors()) {
self::add_notice('frontend_colors');
}
if ($this->has_not_confirmed_tracking()) {
self::add_notice('tracking');
}
if (!current_theme_supports('woocommerce') && !in_array(get_option('template'), wc_get_core_supported_themes())) {
self::add_notice('theme_support');
}
self::add_notice('template_files');
}
示例3: _e
</td>
</tr>
<?php
}
?>
<tr>
<td data-export-label="WooCommerce Support"><?php
_e('WooCommerce Support', 'woocommerce');
?>
:</td>
<td class="help"><?php
echo wc_help_tip(__('Displays whether or not the current active theme declares WooCommerce support.', 'woocommerce'));
?>
</td>
<td><?php
if (!current_theme_supports('woocommerce') && !in_array($active_theme->template, wc_get_core_supported_themes())) {
echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . __('Not Declared', 'woocommerce') . '</mark>';
} else {
echo '<mark class="yes"><span class="dashicons dashicons-yes"></span></mark>';
}
?>
</td>
</tr>
</tbody>
</table>
<table class="wc_status_table widefat" cellspacing="0">
<thead>
<tr>
<th colspan="3" data-export-label="Templates"><h2><?php
_e('Templates', 'woocommerce');
echo wc_help_tip(__('This section shows any files that are overriding the default WooCommerce template pages.', 'woocommerce'));
示例4: test_wc_get_core_supported_themes
/**
* Test wc_get_core_supported_themes().
*
* @since 2.2
*/
public function test_wc_get_core_supported_themes()
{
$expected_themes = array('twentysixteen', 'twentyfifteen', 'twentyfourteen', 'twentythirteen', 'twentyeleven', 'twentytwelve', 'twentyten');
$this->assertEquals($expected_themes, wc_get_core_supported_themes());
}
示例5: get_theme_info
/**
* Get info on the current active theme, info on parent theme (if presnet)
* and a list of template overrides.
*
* @return array
*/
public function get_theme_info()
{
$active_theme = wp_get_theme();
// Get parent theme info if this theme is a child theme, otherwise
// pass empty info in the response.
if (is_child_theme()) {
$parent_theme = wp_get_theme($active_theme->Template);
$parent_theme_info = array('parent_name' => $parent_theme->Name, 'parent_version' => $parent_theme->Version, 'parent_version_latest' => WC_Admin_Status::get_latest_theme_version($parent_theme), 'parent_author_url' => $parent_theme->{'Author URI'});
} else {
$parent_theme_info = array('parent_name' => '', 'parent_version' => '', 'parent_version_latest' => '', 'parent_author_url' => '');
}
/**
* Scan the theme directory for all WC templates to see if our theme
* overrides any of them.
*/
$override_files = array();
$outdated_templates = false;
$scan_files = WC_Admin_Status::scan_template_files(WC()->plugin_path() . '/templates/');
foreach ($scan_files as $file) {
if (file_exists(get_stylesheet_directory() . '/' . $file)) {
$theme_file = get_stylesheet_directory() . '/' . $file;
} elseif (file_exists(get_stylesheet_directory() . '/' . WC()->template_path() . $file)) {
$theme_file = get_stylesheet_directory() . '/' . WC()->template_path() . $file;
} elseif (file_exists(get_template_directory() . '/' . $file)) {
$theme_file = get_template_directory() . '/' . $file;
} elseif (file_exists(get_template_directory() . '/' . WC()->template_path() . $file)) {
$theme_file = get_template_directory() . '/' . WC()->template_path() . $file;
} else {
$theme_file = false;
}
if (!empty($theme_file)) {
$core_version = WC_Admin_Status::get_file_version(WC()->plugin_path() . '/templates/' . $file);
$theme_version = WC_Admin_Status::get_file_version($theme_file);
if ($core_version && (empty($theme_version) || version_compare($theme_version, $core_version, '<'))) {
if (!$outdated_templates) {
$outdated_templates = true;
}
}
$override_files[] = array('file' => str_replace(WP_CONTENT_DIR . '/themes/', '', $theme_file), 'version' => $theme_version, 'core_version' => $core_version);
}
}
$active_theme_info = array('name' => $active_theme->Name, 'version' => $active_theme->Version, 'version_latest' => WC_Admin_Status::get_latest_theme_version($active_theme), 'author_url' => esc_url_raw($active_theme->{'Author URI'}), 'is_child_theme' => is_child_theme(), 'has_woocommerce_support' => current_theme_supports('woocommerce') || in_array($active_theme->template, wc_get_core_supported_themes()), 'has_woocommerce_file' => file_exists(get_stylesheet_directory() . '/woocommerce.php') || file_exists(get_template_directory() . '/woocommerce.php'), 'has_outdated_templates' => $outdated_templates, 'overrides' => $override_files);
return array_merge($active_theme_info, $parent_theme_info);
}
示例6: theme_check_notice
/**
* Show the Theme Check notice
*/
public function theme_check_notice()
{
if (!current_theme_supports('woocommerce') && !in_array(get_option('template'), wc_get_core_supported_themes())) {
include 'views/html-notice-theme-support.php';
}
}
示例7: get_theme_info
/**
* Get the current theme info, theme name and version
* @return array
*/
public static function get_theme_info()
{
$wp_version = get_bloginfo('version');
if (version_compare($wp_version, '3.4', '<')) {
$theme_data = get_theme_data(get_stylesheet_directory() . '/style.css');
$theme_name = $theme_data['Name'];
$theme_version = $theme_data['Version'];
} else {
$theme_data = wp_get_theme();
$theme_name = $theme_data->Name;
$theme_version = $theme_data->Version;
}
$theme_child_theme = is_child_theme() ? 'Yes' : 'No';
$theme_wc_support = !current_theme_supports('woocommerce') && !in_array($theme_data->template, wc_get_core_supported_themes()) ? 'No' : 'Yes';
return array('name' => $theme_name, 'version' => $theme_version, 'child_theme' => $theme_child_theme, 'wc_support' => $theme_wc_support);
}