本文整理汇总了PHP中wp_dashboard_setup函数的典型用法代码示例。如果您正苦于以下问题:PHP wp_dashboard_setup函数的具体用法?PHP wp_dashboard_setup怎么用?PHP wp_dashboard_setup使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wp_dashboard_setup函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: wp_dashboard_setup
<?php
/**
* Dashboard Administration Screen
*
* @internal This file should be parseable by PHP4.
*
* @package WordPress
* @subpackage Administration
*/
/** Load WordPress Bootstrap */
require_once './admin.php';
/** Load WordPress dashboard API */
require_once ABSPATH . 'wp-admin/includes/dashboard.php';
wp_dashboard_setup();
wp_enqueue_script('dashboard');
if (current_user_can('edit_theme_options')) {
wp_enqueue_script('customize-loader');
}
if (current_user_can('install_plugins')) {
wp_enqueue_script('plugin-install');
}
if (current_user_can('upload_files')) {
wp_enqueue_script('media-upload');
}
add_thickbox();
if (wp_is_mobile()) {
wp_enqueue_script('jquery-touch-punch');
}
$title = __('Dashboard');
$parent_file = 'index.php';
示例2: jbst_tmpadminheader
function jbst_tmpadminheader()
{
/**
* Dashboard Administration Screen
*
* @package WordPress
* @subpackage Administration
*/
/** Load WordPress Bootstrap */
require_once ABSPATH . 'wp-admin/admin.php';
/** Load WordPress dashboard API */
require_once ABSPATH . 'wp-admin/includes/dashboard.php';
wp_dashboard_setup();
wp_enqueue_script('dashboard');
if (current_user_can('edit_theme_options')) {
wp_enqueue_script('customize-loader');
}
if (current_user_can('install_plugins')) {
wp_enqueue_script('plugin-install');
}
if (current_user_can('upload_files')) {
wp_enqueue_script('media-upload');
}
add_thickbox();
if (wp_is_mobile()) {
wp_enqueue_script('jquery-touch-punch');
}
$title = __('Customizer credentials', 'jamedo-bootstrap-start-theme');
$parent_file = 'index.php';
include ABSPATH . 'wp-admin/admin-header.php';
}
示例3: load_dashboard
public function load_dashboard($load_title = false)
{
global $plugin_page, $hook_suffix, $current_screen, $title, $menu, $submenu, $pagenow, $typenow;
$hook_suffix = 'admin.php';
$pagenow = 'admin.php';
$typenow = '';
$title = __('Dashboard', 'mainwp');
$this->init_load();
if (wp_verify_nonce($_REQUEST['nonce'], 'mainwp_ajax')) {
if ($load_title) {
echo esc_html($this->get_title());
exit;
}
set_current_screen();
require_once ABSPATH . 'wp-admin/includes/dashboard.php';
wp_dashboard_setup();
wp_enqueue_script('dashboard');
wp_enqueue_script('plugin-install');
wp_enqueue_script('media-upload');
add_thickbox();
$title = __('Dashboard');
$parent_file = 'index.php';
if (is_user_admin()) {
add_screen_option('layout_columns', array('max' => 4, 'default' => 2));
} else {
add_screen_option('layout_columns', array('max' => 4, 'default' => 2));
}
//$screen_layout_columns = 2;
$help = '<p>' . __('Welcome to your WordPress Dashboard! This is the screen you will see when you log in to your site, and gives you access to all the site management features of WordPress. You can get help for any screen by clicking the Help tab in the upper corner.', 'mainwp') . '</p>';
get_current_screen()->add_help_tab(array('id' => 'overview', 'title' => __('Overview', 'mainwp'), 'content' => $help));
// Help tabs
$help = '<p>' . __('The left-hand navigation menu provides links to all of the WordPress administration screens, with submenu items displayed on hover. You can minimize this menu to a narrow icon strip by clicking on the Collapse Menu arrow at the bottom.', 'mainwp') . '</p>';
$help .= '<p>' . __('Links in the Toolbar at the top of the screen connect your dashboard and the front end of your site, and provide access to your profile and helpful WordPress information.', 'mainwp') . '</p>';
get_current_screen()->add_help_tab(array('id' => 'help-navigation', 'title' => __('Navigation', 'mainwp'), 'content' => $help));
$help = '<p>' . __('You can use the following controls to arrange your Dashboard screen to suit your workflow. This is true on most other administration screens as well.', 'mainwp') . '</p>';
$help .= '<p>' . __('<strong>Screen Options</strong> - Use the Screen Options tab to choose which Dashboard boxes to show, and how many columns to display.', 'mainwp') . '</p>';
$help .= '<p>' . __('<strong>Drag and Drop</strong> - To rearrange the boxes, drag and drop by clicking on the title bar of the selected box and releasing when you see a gray dotted-line rectangle appear in the location you want to place the box.', 'mainwp') . '</p>';
$help .= '<p>' . __('<strong>Box Controls</strong> - Click the title bar of the box to expand or collapse it. In addition, some box have configurable content, and will show a “Configure” link in the title bar if you hover over it.', 'mainwp') . '</p>';
get_current_screen()->add_help_tab(array('id' => 'help-layout', 'title' => __('Layout', 'mainwp'), 'content' => $help));
$help = '<p>' . __('The boxes on your Dashboard screen are:', 'mainwp') . '</p>';
$help .= '<p>' . __('<strong>Right Now</strong> - Displays a summary of the content on your site and identifies which theme and version of WordPress you are using.', 'mainwp') . '</p>';
$help .= '<p>' . __('<strong>Recent Comments</strong> - Shows the most recent comments on your posts (configurable, up to 30) and allows you to moderate them.', 'mainwp') . '</p>';
$help .= '<p>' . __('<strong>Incoming Links</strong> - Shows links to your site found by Google Blog Search.', 'mainwp') . '</p>';
$help .= '<p>' . __('<strong>QuickPress</strong> - Allows you to create a new post and either publish it or save it as a draft.', 'mainwp') . '</p>';
$help .= '<p>' . __('<strong>Recent Drafts</strong> - Displays links to the 5 most recent draft posts you’ve started.', 'mainwp') . '</p>';
$help .= '<p>' . __('<strong>WordPress Blog</strong> - Latest news from the official WordPress project.', 'mainwp') . '</p>';
$help .= '<p>' . __('<strong>Other WordPress News</strong> - Shows the <a href="http://planet.wordpress.org" target="_blank">WordPress Planet</a> feed. You can configure it to show a different feed of your choosing.', 'mainwp') . '</p>';
$help .= '<p>' . __('<strong>Plugins</strong> - Features the most popular, newest, and recently updated plugins from the WordPress.org Plugin Directory.', 'mainwp') . '</p>';
get_current_screen()->add_help_tab(array('id' => 'help-content', 'title' => __('Content', 'mainwp'), 'content' => $help));
unset($help);
get_current_screen()->set_help_sidebar('<p><strong>' . __('For more information:', 'mainwp') . '</strong></p>' . '<p>' . __('<a href="http://codex.wordpress.org/Dashboard_Screen" target="_blank">Documentation on Dashboard</a>', 'mainwp') . '</p>' . '<p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>', 'mainwp') . '</p>');
$today = current_time('mysql', 1);
?>
<?php
screen_meta($current_screen);
// Back compatibility with 3.2
//$current_screen->render_screen_meta(); // For 3.3
?>
<div class="wrap">
<?php
screen_icon('index');
?>
<h2><?php
echo esc_html($title);
?>
</h2>
<?php
wp_welcome_panel();
?>
<div id="dashboard-widgets-wrap">
<?php
wp_dashboard();
?>
<div class="clear"></div>
</div>
<!-- dashboard-widgets-wrap -->
</div><!-- wrap -->
<?php
}
exit;
}
示例4: admin_main
function admin_main($data)
{
global $wp_meta_boxes, $wp_dashboard_control_callbacks;
if (!$data) {
$data = array();
}
?>
<div class='level-operation' id='main-dashboard'>
<h2 class='sidebar-name'><?php
_e('Dashboard Widgets', 'membership');
?>
<span><a href='#remove' class='removelink' id='remove-dashboard' title='<?php
_e("Remove Dashboard Widgets from this rules area.", 'membership');
?>
'><?php
_e('Remove', 'membership');
?>
</a></span></h2>
<div class='inner-operation'>
<p><?php
_e('Select the Dashboard widgets to be covered by this rule by checking the box next to the relevant pages title.', 'membership');
?>
</p>
<?php
include_once ABSPATH . '/wp-admin/includes/dashboard.php';
wp_dashboard_setup();
if (!empty($wp_meta_boxes['membership_page_membershiplevels']['normal']['core']) || !empty($wp_meta_boxes['membership_page_membershiplevels']['side']['core'])) {
?>
<table cellspacing="0" class="widefat fixed">
<thead>
<tr>
<th style="" class="manage-column column-cb check-column" id="cb" scope="col"><input type="checkbox"></th>
<th style="" class="manage-column column-name" id="name" scope="col"><?php
_e('Dashboard Widget', 'membership');
?>
</th>
</tr>
</thead>
<tfoot>
<tr>
<th style="" class="manage-column column-cb check-column" id="cb" scope="col"><input type="checkbox"></th>
<th style="" class="manage-column column-name" id="name" scope="col"><?php
_e('Dashboard Widget', 'membership');
?>
</th>
</tr>
</tfoot>
<tbody>
<?php
foreach ($wp_meta_boxes['membership_page_membershiplevels']['normal']['core'] as $key => $m) {
if (!empty($m['title'])) {
?>
<tr valign="middle" class="alternate" id="dashboard-<?php
echo $key;
?>
">
<th class="check-column" scope="row">
<input type="checkbox" value="<?php
echo $key;
?>
" name="dashboard[]" <?php
if (in_array($key, $data)) {
echo 'checked="checked"';
}
?>
>
</th>
<td class="column-name">
<strong><?php
echo esc_html(strip_tags($m['title']));
?>
</strong>
</td>
</tr>
<?php
}
}
?>
<?php
foreach ($wp_meta_boxes['membership_page_membershiplevels']['side']['core'] as $key => $m) {
if (!empty($m['title'])) {
?>
<tr valign="middle" class="alternate" id="dashboard-<?php
echo $key;
?>
">
<th class="check-column" scope="row">
<input type="checkbox" value="<?php
echo $key;
?>
" name="dashboard[]" <?php
if (in_array($key, $data)) {
echo 'checked="checked"';
}
?>
>
</th>
<td class="column-name">
//.........这里部分代码省略.........
示例5: get_dashboard_widgets
public static function get_dashboard_widgets()
{
global $typenow, $wp_meta_boxes;
if (empty(self::$dashboard_widgets)) {
remove_action('wp_dashboard_setup', array('piklist_wordpress_helpers', 'remove_dashboard_widgets'), self::$filter_priority);
if (!function_exists('wp_dashboard_setup')) {
include_once ABSPATH . '/wp-admin/includes/dashboard.php';
}
wp_dashboard_setup();
$meta_boxes = current($wp_meta_boxes);
foreach (array('normal', 'advanced', 'side') as $context) {
foreach (array('high', 'core', 'default', 'low') as $priority) {
if (isset($meta_boxes[$context][$priority])) {
foreach ($meta_boxes[$context][$priority] as $meta_box => $data) {
self::$dashboard_widgets[$meta_box]['title'] = $data['title'];
self::$dashboard_widgets[$meta_box]['context'] = $context;
self::$dashboard_widgets[$meta_box]['priority'] = $priority;
}
}
}
}
}
return self::$dashboard_widgets;
}
示例6: get_default_dashboard_widgets
/**
* Get the default dashboard widgets.
*
* @return array Sidebar widgets.
*/
protected function get_default_dashboard_widgets()
{
global $wp_meta_boxes;
if (!is_array($wp_meta_boxes['dashboard'])) {
require_once ABSPATH . '/wp-admin/includes/dashboard.php';
$current_screen = get_current_screen();
set_current_screen('dashboard');
remove_action('wp_dashboard_setup', array($this, 'disable_dashboard_widgets'), 100);
wp_dashboard_setup();
if (is_callable(array('Antispam_Bee', 'add_dashboard_chart'))) {
Antispam_Bee::add_dashboard_chart();
}
add_action('wp_dashboard_setup', array($this, 'disable_dashboard_widgets'), 100);
set_current_screen($current_screen);
}
if (isset($wp_meta_boxes['dashboard'][0])) {
unset($wp_meta_boxes['dashboard'][0]);
}
$widgets = array();
if (isset($wp_meta_boxes['dashboard'])) {
$widgets = $wp_meta_boxes['dashboard'];
}
/**
* Filters the available dashboard widgets.
*
* @param array $widgets The globally available dashboard widgets.
*/
return apply_filters('wp_widget_disable_default_dashboard_widgets', $widgets);
}