本文整理汇总了PHP中esc_html__函数的典型用法代码示例。如果您正苦于以下问题:PHP esc_html__函数的具体用法?PHP esc_html__怎么用?PHP esc_html__使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了esc_html__函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: kt_add_option_to_vc
function kt_add_option_to_vc()
{
$color_arr = array('vc_btn', 'vc_icon', 'vc_tta_accordion', 'vc_tta_tabs', 'vc_tta_tour');
foreach ($color_arr as $item) {
$button_colors = WPBMap::getParam($item, 'color');
$button_colors['value'][esc_html__('Accent color', 'adroit')] = 'accent';
vc_update_shortcode_param($item, $button_colors);
}
$background_arr = array('vc_icon');
foreach ($background_arr as $item) {
$button_colors = WPBMap::getParam($item, 'background_color');
$button_colors['value'][esc_html__('Accent color', 'adroit')] = 'accent';
vc_update_shortcode_param($item, $button_colors);
}
$image_styles = WPBMap::getParam('vc_single_image', 'style');
$image_styles['value'][esc_html__('Border box', 'adroit')] = 'border-box';
$image_styles['value'][esc_html__('Border box Left', 'adroit')] = 'border-left';
$image_styles['value'][esc_html__('Border box Right', 'adroit')] = 'border-right';
$image_styles['value'][esc_html__('Creative Left', 'adroit')] = 'creative-left';
$image_styles['value'][esc_html__('Creative Right', 'adroit')] = 'creative-right';
$image_styles['value'][esc_html__('Creative When hover', 'adroit')] = 'creative-hover';
vc_update_shortcode_param('vc_single_image', $image_styles);
$icon_btn = array('i_type', 'i_icon_fontawesome', 'i_icon_openiconic', 'i_icon_typicons', 'i_icon_entypo', 'i_icon_linecons', 'i_icon_pixelicons', 'css_animation', 'el_class');
foreach ($icon_btn as $item) {
vc_remove_param('vc_btn', $item);
}
}
开发者ID:websideas,项目名称:aquila,代码行数:27,代码来源:js_composer_update.php
示例2: form
public function form($instance)
{
$default = array('title' => '', 'number' => 2, 'is_show_date' => '', 'is_show_img' => '');
$instance = wp_parse_args((array) $instance, $default);
$yes_no_options = array('yes' => esc_html__('Yes', 'adventure-tours'), 'no' => esc_html__('No', 'adventure-tours'));
echo '<p>' . '<label for="' . esc_attr($this->get_field_id('title')) . '">' . esc_html__('Title', 'adventure-tours') . ':</label>' . '<input class="widefat" id="' . esc_attr($this->get_field_id('title')) . '" name="' . esc_attr($this->get_field_name('title')) . '" type="text" value="' . esc_attr($instance['title']) . '">' . '</p>' . '<p>' . '<label for="' . esc_attr($this->get_field_id('number')) . '">' . esc_html__('Number of posts to show', 'adventure-tours') . ':</label>' . '<input id="' . esc_attr($this->get_field_id('number')) . '" name="' . esc_attr($this->get_field_name('number')) . '" type="text" value="' . esc_attr($instance['number']) . '" size="3">' . '</p>' . '<p>' . '<label for="' . esc_attr($this->get_field_id('is_show_date')) . '">' . esc_html__('Display post date?', 'adventure-tours') . '</label>' . '<select class="widefat" id="' . esc_attr($this->get_field_id('is_show_date')) . '" name="' . esc_attr($this->get_field_name('is_show_date')) . '">' . $this->render_options_html($yes_no_options, $instance['is_show_date']) . '</select>' . '</p>' . '<p>' . '<label for="' . esc_attr($this->get_field_id('is_show_img')) . '">' . esc_html__('Display post image?', 'adventure-tours') . '</label>' . '<select class="widefat" id="' . esc_attr($this->get_field_id('is_show_img')) . '" name="' . esc_attr($this->get_field_name('is_show_img')) . '">' . $this->render_options_html($yes_no_options, $instance['is_show_img']) . '</select>' . '</p>';
}
开发者ID:j-kenneth,项目名称:Expeero,代码行数:7,代码来源:AtWidgetLatestPosts.php
示例3: __construct
/**
* Hook into queries, admin screens, and more!
*
* @since 0.1.2
*/
public function __construct($file = '')
{
// Setup the labels
$this->labels = array('singular' => esc_html__('Visibility', 'wp-term-color'), 'plural' => esc_html__('Visibilities', 'wp-term-color'), 'description' => esc_html__('The visibiilty is used to restrict specific terms to specific users.', 'wp-term-color'));
// Call the parent and pass the file
parent::__construct($file);
}
开发者ID:wir,项目名称:wp-term-visibility,代码行数:12,代码来源:class-wp-term-visibility.php
示例4: add_team_member_meta_boxes
/**
* Adds the resource meta boxes.
*/
function add_team_member_meta_boxes()
{
if (!is_admin()) {
return;
}
add_meta_box('fz_team_member_meta_box', esc_html__('Team Member Profile Info', 'fzp'), __NAMESPACE__ . '\\display_team_member_meta_box', get_team_members_post_type_name(), 'normal', 'default');
}
开发者ID:bradghz,项目名称:ThisIsSoMetaTalk,代码行数:10,代码来源:team-members-meta.php
示例5: form
public function form($instance)
{
if (isset($instance['title'])) {
$title = $instance['title'];
} else {
$title = esc_html__('Site Links', 'wise-blog');
}
// Backend Admin Form
?>
<p>
<label for="<?php
echo esc_attr($this->get_field_id('title'));
?>
"><?php
esc_html_e('Title:', 'wise-blog');
?>
</label>
<input class="widefat" id="<?php
echo esc_attr($this->get_field_id('title'));
?>
" name="<?php
echo esc_attr($this->get_field_name('title'));
?>
" type="text" value="<?php
echo esc_attr($title);
?>
">
</p>
<?php
}
开发者ID:Falkvinge,项目名称:BlogTheme2016,代码行数:31,代码来源:wise-sitelinks.php
示例6: huesos_edd_show_header_cart_link
/**
* Show cart link and quantity count in header if the cart has contents.
*
* The ".edd-cart-quantity" class is needed in order for the quantity to be
* updated dynamically via AJAX.
*
* @todo Add cart link to mobile navigation bar.
*
* @since 1.0.0
*/
function huesos_edd_show_header_cart_link()
{
if (!edd_get_cart_contents()) {
return;
}
printf('<p class="cart-quantity"><a class="button" href="%1$s">%2$s (<span class="edd-cart-quantity">%3$s</span>)</a></p>', esc_url(edd_get_checkout_uri()), esc_html__('Cart', 'huesos'), esc_html(edd_get_cart_quantity()));
}
开发者ID:TyRichards,项目名称:ty_the_band,代码行数:17,代码来源:easy-digital-downloads.php
示例7: carelib_metabox_post_styles_add
/**
* Adds the style meta box.
*
* @since 1.0.0
* @access public
* @param string $post_type
* @param object $post
* @return void
*/
function carelib_metabox_post_styles_add($post_type, $post)
{
$styles = carelib_get_post_styles($post_type);
if (!empty($styles) && current_user_can('edit_theme_options')) {
add_meta_box('carelib-post-style', esc_html__('Style', 'carelib'), 'carelib_metabox_post_styles_box', $post_type, 'side', 'default');
}
}
开发者ID:wpsitecare,项目名称:carelib,代码行数:16,代码来源:metabox-post-styles.php
示例8: barcelona_enqueue_scripts
function barcelona_enqueue_scripts()
{
wp_enqueue_script('jquery');
if (!is_admin()) {
$barcelona_post_id = NULL;
if (is_singular()) {
global $post;
$barcelona_post_id = $post->ID;
}
/*
* Enqueue Styles
*/
$barcelona_font = barcelona_get_font();
wp_register_style('barcelona-font', esc_url($barcelona_font[0]));
wp_enqueue_style('barcelona-font');
wp_register_style('bootstrap', BARCELONA_THEME_PATH . 'assets/css/bootstrap.min.css', array(), '3.3.4');
wp_enqueue_style('bootstrap');
wp_register_style('font-awesome', BARCELONA_THEME_PATH . 'assets/css/font-awesome.min.css', array(), '4.4.0');
wp_enqueue_style('font-awesome');
wp_register_style('vs-preloader', BARCELONA_THEME_PATH . 'assets/css/vspreloader.min.css');
wp_enqueue_style('vs-preloader');
wp_register_style('owl-carousel', BARCELONA_THEME_PATH . 'assets/lib/owl-carousel/assets/owl.carousel.min.css', array(), '2.0.0');
wp_enqueue_style('owl-carousel');
wp_register_style('owl-theme', BARCELONA_THEME_PATH . 'assets/lib/owl-carousel/assets/owl.theme.default.min.css', array(), '2.0.0');
wp_enqueue_style('owl-theme');
wp_register_style('jquery-boxer', BARCELONA_THEME_PATH . 'assets/css/jquery.fs.boxer.min.css', array(), '3.3.0');
wp_enqueue_style('jquery-boxer');
wp_register_style('barcelona-stylesheet', BARCELONA_THEME_PATH . 'style.css', array(), BARCELONA_THEME_VERSION);
wp_enqueue_style('barcelona-stylesheet');
if (is_rtl()) {
wp_register_style('barcelona-rtl', BARCELONA_THEME_PATH . 'assets/css/barcelona-rtl.css', array(), BARCELONA_THEME_VERSION);
wp_enqueue_style('barcelona-rtl');
}
/*
* Enqueue Scripts
*/
wp_register_script('ie-html5', BARCELONA_THEME_PATH . 'assets/js/html5.js');
wp_enqueue_script('ie-html5');
wp_register_script('bootstrap', BARCELONA_THEME_PATH . 'assets/js/bootstrap.min.js', array('jquery'), '3.3.4', true);
wp_enqueue_script('bootstrap');
wp_register_script('retina-js', BARCELONA_THEME_PATH . 'assets/js/retina.min.js');
wp_enqueue_script('retina-js');
wp_register_script('picturefill', BARCELONA_THEME_PATH . 'assets/js/picturefill.min.js', array(), false, true);
wp_enqueue_script('picturefill');
wp_register_script('owl-carousel', BARCELONA_THEME_PATH . 'assets/lib/owl-carousel/owl.carousel.min.js', array('jquery'), '2.0.0', true);
wp_enqueue_script('owl-carousel');
wp_register_script('boxer', BARCELONA_THEME_PATH . 'assets/js/jquery.fs.boxer.min.js', array('jquery'), '3.3.0', true);
wp_enqueue_script('boxer');
if (is_active_widget(false, false, 'barcelona-gplus-box')) {
wp_register_script('google-platform', esc_url('//apis.google.com/js/platform.js'), false, true);
wp_enqueue_script('google-platform');
}
if (is_singular() && comments_open() && get_option('thread_comments')) {
wp_enqueue_script('comment-reply');
}
wp_register_script('barcelona-main', BARCELONA_THEME_PATH . 'assets/js/barcelona-main.js', array('jquery'), BARCELONA_THEME_VERSION, true);
wp_enqueue_script('barcelona-main');
wp_localize_script('barcelona-main', 'barcelonaParams', array('ajaxurl' => esc_url(admin_url('admin-ajax.php')), 'post_id' => $barcelona_post_id, 'i18n' => array('login_to_vote' => esc_html__('Please login to vote!', 'barcelona'))));
}
}
开发者ID:yalmaa,项目名称:little-magazine,代码行数:60,代码来源:scripts.php
示例9: gmb_show_upgrade_notices
/**
* Display Upgrade Notices.
*
* @since 2.0
* @return void
*/
function gmb_show_upgrade_notices()
{
// Don't show notices on the upgrades page.
if (isset($_GET['page']) && $_GET['page'] == 'gmb-upgrades') {
return;
}
//Check to see if we have any posts.
$gmb_posts = get_posts(array('post_type' => 'google_maps', 'posts_per_page' => 10));
if (empty($gmb_posts)) {
update_option('gmb_refid_upgraded', 'upgraded');
//mark as updated.
return;
//Don't run if there's no posts!
}
$gmb_version = get_option('gmb_version');
if (!$gmb_version) {
// 2.0 is the first version to use this option so we must add it.
$gmb_version = '2.0';
}
update_option('gmb_version', GMB_VERSION);
$gmb_version = preg_replace('/[^0-9.].*/', '', $gmb_version);
if (version_compare($gmb_version, '2.0', '<=') && !get_option('gmb_refid_upgraded')) {
printf('<div class="updated"><p><strong>' . __('Maps Builder Update Required', 'google-maps-builder') . ':</strong> ' . esc_html__('Google has updated their Maps API to use the new Google Places ID rather than previous Reference ID. The old method will soon be deprecated and eventually go offline. We are being proactive and would like to update your maps to use the new Places ID. Once you upgrade, your maps should work just fine but remember to make a backup prior to upgrading. If you choose not to upgrade Google will eventually take the old reference ID offline (no date has been given). Please contact WordImpress support via our website if you have any further questions or issues. %sClick here to upgrade your maps to use the new Places ID%s', 'google-maps-builder') . '</p></div>', '<br><a href="' . esc_url(admin_url('options.php?page=gmb-upgrades')) . '" class="button button-primary" style="margin-top:10px;">', '</a>');
} elseif (version_compare($gmb_version, '2.1', '<=') && !gmb_has_upgrade_completed('gmb_markers_upgraded')) {
printf('<div class="updated"><p><strong>' . __('Maps Builder Update Required', 'google-maps-builder') . ':</strong> ' . esc_html__('An upgrade is required to update your Google maps with the latest plugin version. Please perform a site backup and then upgrade. %sClick here to upgrade your maps%s', 'google-maps-builder') . '</p></div>', '<br><a href="' . esc_url(admin_url('options.php?page=gmb-upgrades')) . '" class="button button-primary" style="margin-top:10px;">', '</a>');
}
}
开发者ID:WordImpress,项目名称:maps-builder-core,代码行数:33,代码来源:upgrade-functions.php
示例10: ingot_maybe_load
/**
* Load plugin if possible
*
* @since 0.0.0
*/
function ingot_maybe_load()
{
$fail = false;
if (!version_compare(PHP_VERSION, '5.5.0', '>=')) {
$fail = true;
if (is_admin()) {
include_once dirname(__FILE__) . '/vendor/calderawp/dismissible-notice/src/functions.php';
$message = esc_html__(sprintf('Ingot requires PHP version 5.5.0 or later. Current version is %s.', PHP_VERSION), 'ingot');
if (function_exists('caldera_warnings_dismissible_notice')) {
echo caldera_warnings_dismissible_notice($message, true, 'activate_plugins');
}
}
}
global $wp_version;
if (!version_compare($wp_version, '4.4', '>=')) {
$fail = true;
if (is_admin()) {
include_once dirname(__FILE__) . '/vendor/calderawp/dismissible-notice/src/functions.php';
$message = esc_html__(sprintf('Ingot requires WordPress version 4.4 or later. Current version is %s.', $wp_version), 'ingot');
echo caldera_warnings_dismissible_notice($message, true, 'activate_plugins');
}
}
if (false == $fail) {
include_once dirname(__FILE__) . '/ingot_bootstrap.php';
add_action('plugins_loaded', array('ingot_bootstrap', 'maybe_load'));
}
}
开发者ID:rene-hermenau,项目名称:ingot,代码行数:32,代码来源:ingot.php
示例11: __construct
function __construct()
{
//load text domains
GFCommon::load_gf_text_domain('gravityforms');
$description = esc_html__('Gravity Forms Widget', 'gravityforms');
WP_Widget::__construct('gform_widget', __('Form', 'gravityforms'), array('classname' => 'gform_widget', 'description' => $description), array('width' => 200, 'height' => 250, 'id_base' => 'gform_widget'));
}
开发者ID:Junaid-Farid,项目名称:gocnex,代码行数:7,代码来源:widget.php
示例12: setUp
function setUp()
{
parent::setUp();
self::$instance = new Publishing_Checklist();
$args = array('label' => esc_html__('Word Count', 'publishing-checklist'), 'callback' => 'ensure_minimum_200_words', 'explanation' => esc_html__('Posts should be at least 200 words.', 'publishing-checklist'), 'post_type' => array('post'));
Publishing_Checklist()->register_task('test-publishing-checklist-word-count', $args);
}
开发者ID:humanmade,项目名称:publishing-checklist,代码行数:7,代码来源:test-publishing-checklist.php
示例13: __construct
/**
* Hook into queries, admin screens, and more!
*
* @since 0.1.0
*/
public function __construct($file = '')
{
// Setup the labels
$this->labels = array('singular' => esc_html__('Family', 'wp-term-families'), 'plural' => esc_html__('Families', 'wp-term-families'), 'description' => esc_html__('The family is used to group terms together using another taxonomy.', 'wp-term-families'));
// Call the parent and pass the file
parent::__construct($file);
}
开发者ID:wir,项目名称:wp-term-families,代码行数:12,代码来源:class-wp-term-family.php
示例14: polygon_register_customizer_sections
/**
* Register customizer sections.
*
* Add sections to the WordPress customizer.
*
* @since 1.0.0
* @param array $wp_customize Array with all customizer data.
*/
function polygon_register_customizer_sections($wp_customize)
{
if (!isset($wp_customize)) {
return;
}
/*
* Example Settings section
*
* This section contains all the parameters you can use when creating a new
* customizer section.
*/
$wp_customize->add_section('example_settings_section', array('title' => esc_html__('Example Settings', 'polygon'), 'description' => esc_html__('This is an example section you can use as a starting point for new customizer sections.'), 'panel' => 'example_panel', 'priority' => 10, 'capability' => 'edit_theme_options', 'theme_supports' => 'polygon-portfolio', 'active_callback' => 'active_callback_function'));
/*
* Basic Settings section
*
* This is an aditional section registered using only the required parameters.
* Use it to contain basic settings / controls.
*/
$wp_customize->add_section('basic_settings_section', array('title' => esc_html__('Basic Settings', 'polygon'), 'panel' => 'example_panel'));
/*
* Advanced Settings section
*
* This is an aditional section registered using only the required parameters.
* Use it to contain advanced or custom settings / controls.
*/
$wp_customize->add_section('advanced_settings_section', array('title' => esc_html__('Advanced Settings', 'polygon'), 'panel' => 'example_panel'));
/*
* Register sections from partials
*
* Register customizer sections from external files.
*/
polygon_customizer_add_sections('example');
polygon_customizer_add_sections('layout');
}
开发者ID:EusebiuOprinoiu,项目名称:polygon-customizer-boilerplate,代码行数:42,代码来源:add-sections.php
示例15: document_title
function document_title($title = '', $sep = '-', $seplocation = 'right')
{
// Remove default seperator and add spacing
if (trim($sep) === '' || $sep === '»' || $sep === '»') {
$sep = '-';
}
$sep = ' ' . $sep . ' ';
// Determine page number, if any
$page_num = '';
if (is_paged()) {
global $page, $paged;
if ($paged >= 2 || $page >= 2) {
$page_num = $sep . sprintf(esc_html__('Page %d', 'ubik'), max($paged, $page));
}
}
// Generate the title using our all-purpose title function
$title = apply_filters('ubik_seo_document_title_raw', ubik_title());
$name = get_bloginfo('name');
$desc = get_bloginfo('description');
// Handle three scenarios: home/front page, archive feeds, and everything else
if (is_front_page() || is_home()) {
$title = $name;
if (!empty($desc) && !is_paged()) {
$title .= $sep . $desc;
}
} elseif (is_feed() && is_archive()) {
$title = $sep . $title;
// Adding the separator alters the default archive feed title output
} else {
$title = $title . $sep . $name;
}
// Sanitize and add page number as needed
$title = esc_html(strip_tags(stripslashes(preg_replace('/\\s+/', ' ', trim($title . $page_num)))));
return apply_filters('ubik_seo_document_title_final', $title);
}
开发者ID:synapticism,项目名称:ubik,代码行数:35,代码来源:seo.php
示例16: column_date
function column_date($post)
{
$html = '';
if ('0000-00-00 00:00:00' == $post->post_date) {
$t_time = $h_time = __('Unpublished', 'jetpack');
$time_diff = 0;
} else {
$t_time = date(__('Y/m/d g:i:s A', 'jetpack'), mysql2date('G', $post->post_date));
$m_time = $post->post_date;
$time = get_post_time('G', true, $post);
$time_diff = time() - $time;
if ($time_diff > 0 && $time_diff < DAY_IN_SECONDS) {
$h_time = sprintf(__('%s ago', 'jetpack'), human_time_diff($time));
} else {
$h_time = mysql2date(__('Y/m/d', 'jetpack'), $m_time);
}
}
$html .= '<abbr title="' . esc_attr($t_time) . '">' . esc_html($h_time) . '</abbr>';
$html .= '<br />';
if ('publish' == $post->post_status) {
$html .= esc_html__('Published', 'jetpack');
} elseif ('future' == $post->post_status) {
if ($time_diff > 0) {
$html .= '<strong class="attention">' . esc_html__('Missed schedule', 'jetpack') . '</strong>';
} else {
$html .= esc_html__('Scheduled', 'jetpack');
}
} else {
$html .= esc_html__('Last Modified', 'jetpack');
}
return $html;
}
开发者ID:moushegh,项目名称:blog-source-configs,代码行数:32,代码来源:omnisearch-posts.php
示例17: wp_user_profiles_add_contextual_help
/**
* Add contextual help
*
* @since 0.2.0
*/
function wp_user_profiles_add_contextual_help()
{
// Static sidebar
get_current_screen()->set_help_sidebar('<p>' . esc_html__('Some information may be displayed publicly on the site.', 'wp-user-profiles') . '</p>' . '<p>' . esc_html__('Always use a strong password, and never give your login information to anyone.', 'wp-user-profiles') . '</p>');
// Allow plugins to easily hook in
do_action('wp_user_profiles_add_contextual_help');
}
开发者ID:LaconicTranslator,项目名称:wp-user-profiles,代码行数:12,代码来源:help.php
示例18: Widget_Class_Name_Widget
function Widget_Class_Name_Widget(){
/* Check if Hybrid-core framework is active */
if( class_exists( 'Hybrid' ) ){
/* Set the widget prefix */
$this->prefix = hybrid_get_prefix();
/* Set the widget textdomain. */
$this->textdomain = hybrid_get_parent_textdomain();
} else {
$this->prefix = 'prefix';
$this->textdomain = 'prefix';
}
$this->widget_id = 'widget-id';
$widget_options = array(
'classname' => "{$this->prefix}-{$this->widget_id}",
'description' => esc_html__( 'Description of the widget', $this->textdomain )
);
$control_options = array(
'height' => '300',
'width' => '240',
'id_base' => "{$this->prefix}-{$this->widget_id}"
);
$this->WP_Widget( "{$this->prefix}-{$this->widget_id}", esc_attr__( 'Widget Name', $this->textdomain ), $widget_options, $control_options );
}
开发者ID:ryannmicua,项目名称:Pogidude-Hybrid,代码行数:30,代码来源:widget-template.php
示例19: slicetheme_team_metaboxes
function slicetheme_team_metaboxes(array $meta_boxes)
{
// Start with an underscore to hide fields from custom fields list
$prefix = '_st_team_';
$meta_boxes[] = array('id' => 'team_metabox', 'title' => 'Team Attributes', 'pages' => array('st_team'), 'context' => 'normal', 'priority' => 'default', 'show_names' => true, 'fields' => array(array('name' => esc_html__('Position', 'slicetheme'), 'desc' => esc_html__('Enter position name in your company.', 'slicetheme'), 'id' => $prefix . 'position', 'type' => 'text_medium'), array('name' => esc_html__('Phone', 'slicetheme'), 'desc' => '', 'id' => $prefix . 'phone', 'type' => 'text_medium'), array('name' => esc_html__('Fax', 'slicetheme'), 'desc' => '', 'id' => $prefix . 'fax', 'type' => 'text_medium'), array('name' => esc_html__('Email Address', 'slicetheme'), 'desc' => '', 'id' => $prefix . 'email', 'type' => 'text_medium'), array('name' => esc_html__('Social Icons', 'slicetheme'), 'desc' => '', 'id' => $prefix . 'social', 'type' => 'st_social_icons')));
return $meta_boxes;
}
开发者ID:love4code,项目名称:originalContracting,代码行数:7,代码来源:st_type_team.php
示例20: hybrid_settings_page_init
/**
* Initializes all the theme settings page functionality. This function is used to create the theme settings
* page, then use that as a launchpad for specific actions that need to be tied to the settings page.
*
* @since 0.7.0
* @global string $hybrid The global theme object.
* @return void
*/
function hybrid_settings_page_init()
{
global $hybrid;
/* Get theme information. */
$theme = wp_get_theme(get_template(), get_theme_root(get_template_directory()));
$prefix = hybrid_get_prefix();
/* Register theme settings. */
register_setting("{$prefix}_theme_settings", "{$prefix}_theme_settings", 'hybrid_save_theme_settings');
/* Create the theme settings page. */
$hybrid->settings_page = add_theme_page(sprintf(esc_html__('%s Theme Settings', 'hybrid-core'), $theme->get('Name')), esc_html__('Theme Settings', 'hybrid-core'), hybrid_settings_page_capability(), 'theme-settings', 'hybrid_settings_page');
/* Check if the settings page is being shown before running any functions for it. */
if (!empty($hybrid->settings_page)) {
/* Filter the settings page capability so that it recognizes the 'edit_theme_options' cap. */
add_filter("option_page_capability_{$prefix}_theme_settings", 'hybrid_settings_page_capability');
/* Add help tabs to the theme settings page. */
add_action("load-{$hybrid->settings_page}", 'hybrid_settings_page_help');
/* Load the theme settings meta boxes. */
add_action("load-{$hybrid->settings_page}", 'hybrid_load_settings_page_meta_boxes');
/* Create a hook for adding meta boxes. */
add_action("load-{$hybrid->settings_page}", 'hybrid_settings_page_add_meta_boxes');
/* Load the JavaScript and stylesheets needed for the theme settings screen. */
add_action('admin_enqueue_scripts', 'hybrid_settings_page_enqueue_scripts');
add_action('admin_enqueue_scripts', 'hybrid_settings_page_enqueue_styles');
add_action("admin_footer-{$hybrid->settings_page}", 'hybrid_settings_page_load_scripts');
}
}
开发者ID:panser,项目名称:wandromaha,代码行数:34,代码来源:theme-settings.php
注:本文中的esc_html__函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论