本文整理汇总了PHP中current_theme_supports函数的典型用法代码示例。如果您正苦于以下问题:PHP current_theme_supports函数的具体用法?PHP current_theme_supports怎么用?PHP current_theme_supports使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了current_theme_supports函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: currencies
/**
* Currency switcher
*
* @access public
* @return void|bool|string
*/
public static function currencies($atts)
{
$atts = shortcode_atts(array(), $atts, 'realia_currencies');
if (!current_theme_supports('realia-currencies')) {
return;
}
$currencies = get_theme_mod('realia_currencies');
if ($currencies == false) {
$currencies = array(array('symbol' => '$', 'code' => 'USD', 'show_after' => false, 'money_decimals' => 2, 'money_dec_point' => '.', 'money_thousands_separator' => ','));
} elseif (!is_array($currencies)) {
return false;
}
array_splice($currencies, get_theme_mod('realia_currencies_other', 0) + 1);
$result = '';
if (!empty($currencies) && is_array($currencies)) {
ksort($currencies);
$currency_code = Realia_Currencies::get_current_currency_code();
$result = '';
ob_start();
include Realia_Template_Loader::locate('misc/currencies');
$result = ob_get_contents();
ob_end_clean();
}
return $result;
}
示例2: genesis_update_check
/**
* Pings http://api.genesistheme.com/ asking if a new version of this theme is
* available.
*
* If not, it returns false.
*
* If so, the external server passes serialized data back to this function,
* which gets unserialized and returned for use.
*
* @since 1.1.0
*
* @uses genesis_get_option()
* @uses PARENT_THEME_VERSION Genesis version string
*
* @global string $wp_version WordPress version string
* @return mixed Unserialized data, or false on failure
*/
function genesis_update_check()
{
global $wp_version;
/** If updates are disabled */
if (!genesis_get_option('update') || !current_theme_supports('genesis-auto-updates')) {
return false;
}
/** Get time of last update check */
$genesis_update = get_transient('genesis-update');
/** If it has expired, do an update check */
if (!$genesis_update) {
$url = 'http://api.genesistheme.com/update-themes/';
$options = apply_filters('genesis_update_remote_post_options', array('body' => array('genesis_version' => PARENT_THEME_VERSION, 'wp_version' => $wp_version, 'php_version' => phpversion(), 'uri' => home_url(), 'user-agent' => "WordPress/{$wp_version};")));
$response = wp_remote_post($url, $options);
$genesis_update = wp_remote_retrieve_body($response);
/** If an error occurred, return FALSE, store for 1 hour */
if ('error' == $genesis_update || is_wp_error($genesis_update) || !is_serialized($genesis_update)) {
set_transient('genesis-update', array('new_version' => PARENT_THEME_VERSION), 60 * 60);
return false;
}
/** Else, unserialize */
$genesis_update = maybe_unserialize($genesis_update);
/** And store in transient for 24 hours */
set_transient('genesis-update', $genesis_update, 60 * 60 * 24);
}
/** If we're already using the latest version, return false */
if (version_compare(PARENT_THEME_VERSION, $genesis_update['new_version'], '>=')) {
return false;
}
return $genesis_update;
}
示例3: roots_scripts
/**
* Scripts and stylesheets
*
* Enqueue stylesheets in the following order:
* 1. /theme/assets/css/main.css
*
* Enqueue scripts in the following order:
* 1. jquery-1.11.1.min.js via Google CDN
* 2. /theme/assets/js/vendor/modernizr.min.js
* 3. /theme/assets/js/scripts.js (in footer)
*
* Google Analytics is loaded after enqueued scripts if:
* - An ID has been defined in config.php
* - You're not logged in as an administrator
*/
function roots_scripts()
{
/**
* The build task in Grunt renames production assets with a hash
* Read the asset names from assets-manifest.json
*/
if (WP_ENV === 'development') {
$assets = array('css' => '/assets/css/main.css', 'js' => '/assets/js/scripts.js', 'modernizr' => '/assets/vendor/modernizr/modernizr.js', 'jquery' => '//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.js');
} else {
$get_assets = file_get_contents(get_template_directory() . '/assets/manifest.json');
$assets = json_decode($get_assets, true);
$assets = array('css' => '/assets/css/main.min.css' . '?' . $assets['assets/css/main.min.css']['hash'], 'js' => '/assets/js/scripts.min.js' . '?' . $assets['assets/js/scripts.min.js']['hash'], 'modernizr' => '/assets/js/vendor/modernizr.min.js', 'jquery' => '//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js');
}
wp_enqueue_style('roots_css', get_template_directory_uri() . $assets['css'], false, null);
/**
* jQuery is loaded using the same method from HTML5 Boilerplate:
* Grab Google CDN's latest jQuery with a protocol relative URL; fallback to local if offline
* It's kept in the header instead of footer to avoid conflicts with plugins.
*/
if (!is_admin() && current_theme_supports('jquery-cdn')) {
wp_deregister_script('jquery');
wp_register_script('jquery', $assets['jquery'], array(), null, false);
add_filter('script_loader_src', 'roots_jquery_local_fallback', 10, 2);
}
if (is_single() && comments_open() && get_option('thread_comments')) {
wp_enqueue_script('comment-reply');
}
wp_enqueue_script('modernizr', get_template_directory_uri() . $assets['modernizr'], array(), null, false);
wp_enqueue_script('jquery');
wp_enqueue_script('roots_js', get_template_directory_uri() . $assets['js'], array(), null, true);
}
示例4: definition
/**
* Custom post type definition
*
* @access public
* @return void
*/
public static function definition()
{
$labels = array('name' => __('FAQ', 'realia'), 'singular_name' => __('FAQ', 'realia'), 'add_new' => __('Add New FAQ', 'realia'), 'add_new_item' => __('Add New FAQ', 'realia'), 'edit_item' => __('Edit FAQ', 'realia'), 'new_item' => __('New FAQ', 'realia'), 'all_items' => __('All FAQ', 'realia'), 'view_item' => __('View FAQ', 'realia'), 'search_items' => __('Search FAQ', 'realia'), 'not_found' => __('No FAQ found', 'realia'), 'not_found_in_trash' => __('No FAQ found in Trash', 'realia'), 'parent_item_colon' => '', 'menu_name' => __('FAQ', 'realia'));
if (current_theme_supports('realia-faq')) {
register_post_type('faq', array('labels' => $labels, 'supports' => array('title', 'editor'), 'public' => true, 'show_ui' => true, 'has_archive' => true, 'rewrite' => array('slug' => __('faq', 'realia')), 'menu_position' => 49, 'categories' => array(), 'menu_icon' => 'dashicons-editor-help'));
}
}
示例5: load_config_section
/**
*/
protected function load_config_section($section_name, $section_array)
{
// not a feature option by default
$feature_option = null;
// sub option syntax?
if (strpos($section_name, self::SUB_OPTION_DELIM)) {
// yes, split at special delim
$parts = explode(self::SUB_OPTION_DELIM, $section_name);
// feature is the first part
$feature = $parts[0];
// name is the second part
$feature_option = $parts[1];
} else {
// feature name is section name
$feature = $section_name;
}
// does theme support this feature?
if (current_theme_supports($feature)) {
// yes, options component enabled?
if ($feature_option && $this->policy()->options() instanceof ICE_Policy) {
// inject feature atts into config array
$section_array['feature'] = $feature;
// is it a sub option?
if ($this->policy()->options()->registry()->load_feature_option($feature_option, $section_array)) {
// yes, skip standard loading
return true;
}
} else {
// load like a regular feature
return parent::load_config_section($section_name, $section_array);
}
}
// feature config *not* loaded
return false;
}
示例6: menu
/**
* Registers menu items
*
* @access public
* @return void
*/
public static function menu()
{
if (current_theme_supports('realia-statistics')) {
add_submenu_page('edit.php?post_type=property', __('Property Views', 'realia'), __('Property Views', 'realia'), 'manage_options', 'property_views', array(__CLASS__, 'property_views_template'));
add_submenu_page('edit.php?post_type=property', __('Search Queries', 'realia'), __('Search Queries', 'realia'), 'manage_options', 'search_queries', array(__CLASS__, 'search_queries_template'));
}
}
示例7: _tm_register_image_sizes
function _tm_register_image_sizes()
{
if (!current_theme_supports('post-thumbnails')) {
return;
}
set_post_thumbnail_size(238, 182, true);
// Registers a new image sizes.
add_image_size('_tm-thumb-s', 150, 150, true);
add_image_size('_tm-thumb-240-100', 240, 100, true);
add_image_size('_tm-thumb-m', 400, 400, true);
add_image_size('_tm-thumb-560-350', 560, 350, true);
add_image_size('_tm-post-thumbnail-large', 770, 480, true);
add_image_size('_tm-thumb-l', 1170, 780, true);
add_image_size('_tm-thumb-xl', 1920, 1080, true);
add_image_size('_tm-thumb-150-115', 150, 115, true);
add_image_size('_tm-thumb-238-182', 238, 182, true);
add_image_size('_tm-thumb-337-258', 337, 258, true);
add_image_size('_tm-thumb-476-365', 476, 365, true);
add_image_size('_tm-thumb-536-411', 536, 411, true);
add_image_size('_tm-thumb-426-327', 426, 327, true);
add_image_size('_tm-thumb-860-662', 860, 662, true);
add_image_size('_tm-thumb-760-585', 760, 585, true);
add_image_size('_tm-thumb-660-508', 660, 508, true);
add_image_size('_tm-thumb-1132-411', 1132, 411, true);
}
示例8: popup_elements
/**
* Popup Elements
*
* If this function is defined in a child class the element automatically gets an edit button, that, when pressed
* opens a modal window that allows to edit the element properties
*
* @return void
*/
function popup_elements()
{
$this->elements = array(array("name" => __("For Developers: Section Class", 'avia_framework'), "desc" => __("Apply a custom Class Attribute to the section, so you can apply a style via CSS.", 'avia_framework') . "<br/><br/>" . __("Use with caution and make sure to only use allowed characters. No special characters can be used.", 'avia_framework'), "id" => "myclass", "type" => "input", "std" => ""), array("name" => __("For Developers: Section ID", 'avia_framework'), "desc" => __("Apply a custom ID Attribute to the section, so you can apply a unique style via CSS. This option is also helpful if you want to use anchor links to scroll to a sections when a link is clicked", 'avia_framework') . "<br/><br/>" . __("Use with caution and make sure to only use allowed characters. No special characters can be used.", 'avia_framework'), "id" => "myid", "type" => "input", "std" => ""), array("name" => __("Tab Position", 'avia_framework'), "desc" => __("Where should the tabs be displayed", 'avia_framework'), "id" => "position", "type" => "select", "std" => "top_tab", 'container_class' => "avia-element-fullwidth", "target" => array('#aviaTBcontent-form-container', 'class'), "subtype" => array(__('Display tabs at the top', 'avia_framework') => 'top_tab', __("Display Tabs on the left", 'avia_framework') => 'sidebar_tab sidebar_tab_left', __("Display Tabs on the right", 'avia_framework') => 'sidebar_tab sidebar_tab_right')), array("name" => __("Boxed Tabs", 'avia_framework'), "desc" => __("Do you want to display a border around your tabs or without border", 'avia_framework'), "id" => "boxed", "type" => "select", "std" => "no", "required" => array('position', 'contains', 'sidebar_tab'), "subtype" => array(__('With border', 'avia_framework') => 'border_tabs', __('Without border', 'avia_framework') => 'noborder_tabs')), array("name" => __("Add/Edit Tabs", 'avia_framework'), "desc" => __("Here you can add, remove and edit the Tabs you want to display.", 'avia_framework'), "type" => "modal_group", "id" => "content", 'container_class' => "avia-element-fullwidth avia-tab-container", "modal_title" => __("Edit Form Element", 'avia_framework'), "std" => array(array('title' => __('Tab 1', 'avia_framework')), array('title' => __('Tab 2', 'avia_framework'))), 'subelements' => array(array("name" => __("Tab Title", 'avia_framework'), "desc" => __("Enter the tab title here (Better keep it short)", 'avia_framework'), "id" => "title", "std" => "Tab Title", "type" => "input"), array("name" => __("Tab Icon", 'avia_framework'), "desc" => __("Should an icon be displayed at the left side of the tab title?", 'avia_framework'), "id" => "icon_select", "type" => "select", "std" => "no", "subtype" => array(__('No Icon', 'avia_framework') => 'no', __('Yes, display Icon', 'avia_framework') => 'yes')), array("name" => __("Tab Icon", 'avia_framework'), "desc" => __("Select an icon for your tab title below", 'avia_framework'), "id" => "icon", "type" => "iconfont", "std" => "", "required" => array('icon_select', 'equals', 'yes')), array("name" => __("Tab Content", 'avia_framework'), "desc" => __("Enter some content here", 'avia_framework'), "id" => "content", "type" => "tiny_mce", "std" => "Tab Content goes here"))), array("name" => __("Initial Open", 'avia_framework'), "desc" => __("Enter the Number of the Tab that should be open initially.", 'avia_framework'), "id" => "initial", "std" => "1", "type" => "input"));
if (current_theme_supports('avia_template_builder_custom_tab_toogle_id')) {
$this->elements[2]['subelements'][] = array("name" => __("For Developers: Custom Tab ID", 'avia_framework'), "desc" => __("Insert a custom ID for the element here. Make sure to only use allowed characters.", 'avia_framework'), "id" => "custom_id", "type" => "input", "std" => "");
}
}
示例9: alfath_scripts
/**
* Enqueue scripts and stylesheets
*
* Enqueue stylesheets in the following order:
* 1. /theme/assets/css/main.min.css
*
* Enqueue scripts in the following order:
* 1. jquery-1.11.0.min.js via Google CDN
* 2. /theme/assets/js/vendor/modernizr-2.7.2.min.js
* 3. /theme/assets/js/main.min.js (in footer)
*/
function alfath_scripts()
{
wp_enqueue_style('alfath_main', get_template_directory_uri() . '/assets/css/main.min.css', false, '1.0.0');
wp_enqueue_style('alfath_fa-icon', get_template_directory_uri() . '/assets/css/font-awesome.min.css', false, '4.0.3');
wp_enqueue_style('alfath-icon', get_template_directory_uri() . '/assets/css/alfath-icon.min.css', false, '1.0.0');
if (file_exists(get_template_directory() . '/assets/css/custom.css')) {
wp_enqueue_style('alfath_custom', get_template_directory_uri() . '/assets/css/custom.css', array('alfath_main'), filemtime(get_template_directory() . '/assets/css/custom.css'), 'all');
}
// jQuery is loaded using the same method from HTML5 Boilerplate:
// Grab Google CDN's latest jQuery with a protocol relative URL; fallback to local if offline
// It's kept in the header instead of footer to avoid conflicts with plugins.
if (!is_admin() && current_theme_supports('jquery-cdn')) {
wp_deregister_script('jquery');
wp_register_script('jquery', '//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js', false, null, false);
add_filter('script_loader_src', 'alfath_jquery_local_fallback', 10, 2);
}
if (is_single() && comments_open() && get_option('thread_comments')) {
wp_enqueue_script('comment-reply');
}
wp_register_script('modernizr', get_template_directory_uri() . '/assets/js/vendor/modernizr-2.7.2.min.js', false, null, false);
wp_register_script('jquery-migrate', get_template_directory_uri() . '/assets/js/vendor/jquery-migrate-1.2.1.min.js', array('jquery'), null, false);
wp_register_script('alfath_scripts', get_template_directory_uri() . '/assets/js/scripts.min.js', false, '1.0.0', true);
wp_enqueue_script('modernizr');
wp_enqueue_script('jquery');
wp_enqueue_script('jquery-migrate');
wp_enqueue_script('alfath_scripts');
}
示例10: tevkori_wp_image_editors
/**
* Filter to add php-respimg as an image editor.
*
* @since 2.3.0
*
* @return array Editors.
**/
function tevkori_wp_image_editors($editors)
{
if (current_theme_supports('advanced-image-compression')) {
array_unshift($editors, 'WP_Image_Editor_Respimg');
}
return $editors;
}
示例11: 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, array('twentyfourteen', 'twentythirteen', 'twentyeleven', 'twentytwelve', 'twentyten'))) {
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'));
}
}
示例12: ctc_get_theme_support_notice
/**
* Show admin notice
*
* Show a message if current theme does not support the plugin.
*
* @since 0.9
*/
function ctc_get_theme_support_notice()
{
// Theme does not support plugin
if (!current_theme_supports('churchthemes-framework')) {
// Show only if user has some control over plugins and themes
if (!current_user_can('activate_plugins') && !current_user_can('switch_themes')) {
return;
}
// Show only on relavent pages as not to overwhelm admin
$screen = get_current_screen();
if (!in_array($screen->base, array('themes', 'plugins')) && !preg_match('/^ctc_.+/', $screen->post_type)) {
return;
}
// Option ID
$theme_data = wp_get_theme();
$option_id = 'ctc_hide_theme_support_notice-' . $theme_data['Template'];
// unique to theme so if change, message shows again
// Message has not been dismissed for this theme
if (!get_option($option_id)) {
?>
<div class="error">
<p><?php
printf(__('The <b>%1$s</b> theme does not support the <b>%2$s</b> plugin. <a href="%3$s" target="_blank">More Information</a>, <a href="%4$s">Dismiss</a>', 'churchthemes-framework'), wp_get_theme(), CTC_NAME, CTC_INFO_URL, add_query_arg('ctc_hide_theme_support_notice', '1'));
?>
</p>
</div>
<?php
}
}
}
示例13: ctc_generic_embeds
/**
* Generic embeds
*
* This helps make embeds more generic by setting parameters to remove
* related videos, set neutral colors, reduce branding, etc.
*
* Enable with: add_theme_support( 'ctc-generic-embeds' );
*
* @since 0.9
* @param string $html Embed HTML code
* @return string Modified embed HTML code
*/
function ctc_generic_embeds($html)
{
// Does theme support this?
if (current_theme_supports('ctc-generic-embeds')) {
// Get iframe source URL
preg_match_all('/<iframe[^>]+src=([\'"])(.+?)\\1[^>]*>/i', $html, $matches);
$url = !empty($matches[2][0]) ? $matches[2][0] : '';
// URL found
if ($url) {
$new_url = '';
$source = '';
$args = array();
// YouTube
if (preg_match('/youtube/i', $url)) {
$source = 'youtube';
$args = array('wmode' => 'transparent', 'rel' => '0', 'showinfo' => '0', 'color' => 'white', 'modestbranding' => '1');
} elseif (preg_match('/vimeo/i', $url)) {
$source = 'vimeo';
$args = array('title' => '0', 'byline' => '0', 'portrait' => '0', 'color' => 'ffffff');
}
// Modify URL
$args = apply_filters('ctc_generic_embeds_add_args', $args, $source);
$new_url = add_query_arg($args, $url);
// Replace source with modified URL
if ($new_url != $url) {
$html = str_replace($url, $new_url, $html);
}
}
}
return $html;
}
示例14: is_html5
static function is_html5()
{
if (self::$is_html5 == null) {
self::$is_html5 = function_exists('current_theme_supports') && current_theme_supports('html5');
}
return self::$is_html5;
}
示例15: is_support_menus
/**
* Check the theme, support menu or not
*
* @see https://codex.wordpress.org/Function_Reference/current_theme_supports
*
* @return boolean
*/
function is_support_menus()
{
if (!current_theme_supports('menus')) {
return false;
}
return true;
}