本文整理汇总了PHP中wp_list_widgets函数的典型用法代码示例。如果您正苦于以下问题:PHP wp_list_widgets函数的具体用法?PHP wp_list_widgets怎么用?PHP wp_list_widgets使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wp_list_widgets函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _ex
?>
<span id="removing-widget"><?php
_ex('Deactivate', 'removing-widget');
?>
<span></span></span></h3>
</div>
<div class="widget-holder">
<div class="sidebar-description">
<p class="description"><?php
_e('To activate a widget drag it to a sidebar or click on it. To deactivate a widget and delete its settings, drag it back.');
?>
</p>
</div>
<div id="widget-list">
<?php
wp_list_widgets();
?>
</div>
<br class='clear' />
</div>
<br class="clear" />
</div>
<?php
$theme_sidebars = array();
foreach ($wp_registered_sidebars as $sidebar => $registered_sidebar) {
if (false !== strpos($registered_sidebar['class'], 'inactive-sidebar') || 'orphaned_widgets' == substr($sidebar, 0, 16)) {
$wrap_class = 'widgets-holder-wrap';
if (!empty($registered_sidebar['class'])) {
$wrap_class .= ' ' . $registered_sidebar['class'];
}
示例2: bizzthemes_layout
function bizzthemes_layout()
{
global $wpdb, $wp_version, $wp_registered_widget_updates, $wp_registered_sidebars, $wp_registered_widgets, $bizz_package, $sidebars_widgets;
// Permissions Check
if (!current_user_can('edit_theme_options')) {
wp_die(__('Cheatin’ uh?', 'bizzthemes'));
}
// WordPress Administration Widgets API
load_template(ABSPATH . 'wp-admin/includes/widgets.php');
// These are the widgets grouped by sidebar
/*
$sidebars_widgets = wp_get_sidebars_widgets();
if ( empty( $sidebars_widgets ) )
$sidebars_widgets = wp_get_widget_defaults();
*/
// Show inactive widgets
$user = get_current_user_id();
$screenopt = get_user_meta($user, 'templates_screen_options', true);
// Mobile
if (wp_is_mobile()) {
wp_enqueue_script('jquery-touch-punch');
}
// Do sidebar action
do_action('sidebar_admin_setup');
// options header
bizzthemes_options_header($options_title = __('Template Builder', 'bizzthemes'), $toggle = false);
if (isset($messages)) {
foreach ($messages as $message) {
echo $message . "\n";
}
}
// register the inactive_widgets area as sidebar
register_sidebar(array('name' => __('Inactive Widgets', 'bizzthemes'), 'id' => 'wp_inactive_widgets', 'class' => 'inactive-sidebar', 'description' => __('Drag widgets here to remove them from the sidebar but keep their settings.', 'bizzthemes'), 'before_widget' => '', 'after_widget' => '', 'before_title' => '', 'after_title' => '', 'grid' => ''));
if (function_exists('retrieve_widgets')) {
retrieve_widgets();
}
do_action('widgets_admin_page');
?>
<div class="manage-templates manage-menus<?php
if (!isset($_REQUEST['tab'])) {
echo ' disabled';
}
?>
">
<div class="label-templates"><?php
_e('Select a template to edit:', 'bizzthemes');
?>
</div>
<div class="select-templates">
<a href="#" class="dropdown-toggle menu-select">
<span dir="ltr"><?php
echo bizz_tabs_active();
?>
</span>
<span class="templates-toggle"></span>
</a>
<div class="dropdown-menu menu-tabs">
<?php
bizz_tabs_list();
?>
</div>
</div>
<a href="#" class="bizzhelp templates-help" onclick="return template_help_toggle();">?</a>
</div>
<div id="widget-frame" class="clearfix">
<div class="widget-liquid-left<?php
if (!isset($_REQUEST['tab'])) {
echo ' liquid-left-disabled';
}
?>
">
<div id="widgets-left">
<div id="available-widgets" class="widgets-holder-wrap">
<div class="sidebar-name">
<div class="sidebar-name-arrow"><br /></div>
<h3><?php
_e('Available Widgets', 'bizzthemes');
?>
<span id="removing-widget"><?php
_e('Deactivate', 'bizzthemes');
?>
<span></span></span></h3>
</div>
<div class="widget-holder">
<p class="description">
<?php
_e('Drag widgets from here to a template on the right to activate them. Drag widgets back here to deactivate them and delete their settings.', 'bizzthemes');
?>
</p>
<div id="widget-list">
<?php
wp_list_widgets();
?>
</div>
<br class='clear' />
</div>
//.........这里部分代码省略.........
示例3: _e
<input type="submit" value="<?php
_e('Show');
?>
" class="button-secondary" />
</div>
</div>
</form>
<div id="widget-content" class="widget-liquid-left-holder">
<div id="available-widgets" class="widget-liquid-left">
<?php
wp_list_widgets($show, $widget_search);
// This lists all the widgets for the query ( $show, $search )
?>
<div class="nav">
<p class="pagenav">
<?php
echo $page_links;
?>
</p>
</div>
</div>
</div>
<form id="widget-controls" action="" method="post">
示例4: foreach
<?php foreach ( $wp_registered_sidebars as $sidebar_id => $registered_sidebar ) : $sidebar_id = attribute_escape( $sidebar_id ); ?>
<option value='<?php echo $sidebar_id; ?>'<?php selected( $sidebar_id, $sidebar ); ?>><?php echo wp_specialchars( $registered_sidebar['name'] ); ?></option>
<?php endforeach; ?>
</select>
<input type="submit" value="<?php _e('Show' ); ?>" class="button-secondary" />
</div>
</div>
</form>
<div id="widget-content" class="widget-liquid-left-holder">
<div id="available-widgets" class="widget-liquid-left">
<?php wp_list_widgets( $show, $widget_search ); // This lists all the widgets for the query ( $show, $search ) ?>
<div class="nav">
<p class="pagenav">
<?php echo $page_links; ?>
</p>
</div>
</div>
</div>
<form id="widget-controls" action="" method="post">
<div id="current-widgets-head" class="widget-liquid-right">
<div id="sidebar-info">
<p><?php echo $sidebar_info_text; ?></p>
示例5: sidebar_admin_metabox
/**
* Generate HTML for meta box
*
* @method sidebar_admin_metabox
* @global Object $post
* @return void
*/
public static function sidebar_admin_metabox()
{
?>
<div id="widget-list" class="voce-post-meta-widget column-1">
<strong><?php
_e('Available Widgets');
?>
</strong>
<p class="description"><?php
_e('Drag widgets from here to widget areas to activate them.');
?>
</p>
<?php
wp_list_widgets();
?>
</div>
<?php
wp_nonce_field('save-sidebar-widgets', '_wpnonce_widgets', false);
?>
<div class="clear"></div>
<?php
}
示例6: display_layout_detail
function display_layout_detail($layout_id, $post_ID)
{
$i = 1;
$update = array('layout_id' => $layout_id, 'post_ID' => $post_ID, 'zones' => array());
require_once ABSPATH . 'wp-admin/includes/widgets.php';
global $wp_registered_widget_updates, $wp_registered_sidebars, $sidebars_widgets, $wp_registered_widgets;
$this->register_zones_as_sidebars();
$sidebars_widgets = wp_get_sidebars_widgets();
if (empty($sidebars_widgets)) {
$sidebars_widgets = wp_get_widget_defaults();
}
?>
<h4><?php
_e("Select a zone and drag a widget", BAOL_PL_TEXTDOMAIN);
?>
</h4>
<div id="widget-list" class="float-break clear">
<?php
wp_list_widgets();
?>
</div>
<div class="details clear">
<ul><?php
foreach ($this->registered_layouts[$layout_id]['zones'] as $i => $zone) {
register_sidebar(array('name' => $zone, 'id' => 'zone-' . $i . '-page-' . $post_ID, 'before_widget' => '<div id="%1$s" class="widget zone %2$s">', 'after_widget' => '</div>', 'before_title' => '<h2 class="widgettitle">', 'after_title' => '</h2>'));
$update['zones'][] = 'zone-' . $i . '-page-' . $post_ID;
?>
<li><a href="#zone-<?php
echo $i;
?>
-panel"><span><?php
echo $zone;
?>
</span></a></li><?php
}
$this->current_layout = $this->set_current_layout($post_ID, $update);
?>
</ul><?php
foreach ($this->registered_layouts[$layout_id]['zones'] as $i => $zone) {
?>
<div id="zone-<?php
echo $i;
?>
-panel">
<div class="widgets-zone-sortables zone-name">
<?php
wp_list_widget_controls('zone-' . $i . '-page-' . $post_ID);
?>
</div>
</div><?php
}
?>
</div>
<div style="display:none !important">
<?php
foreach ($wp_registered_sidebars as $sidebar => $registered_sidebar) {
if (in_array($sidebar, $update['zones'])) {
continue;
}
wp_list_widget_controls($sidebar);
}
?>
</div><?php
}
示例7: do_action
*/
do_action( 'widgets_admin_page' ); ?>
<div class="widget-liquid-left">
<div id="widgets-left">
<div id="available-widgets" class="widgets-holder-wrap">
<div class="sidebar-name">
<div class="sidebar-name-arrow"><br /></div>
<h3><?php _e('Available Widgets'); ?> <span id="removing-widget"><?php _ex('Deactivate', 'removing-widget'); ?> <span></span></span></h3>
</div>
<div class="widget-holder">
<div class="sidebar-description">
<p class="description"><?php _e('To activate a widget drag it to a sidebar or click on it. To deactivate a widget and delete its settings, drag it back.'); ?></p>
</div>
<div id="widget-list">
<?php wp_list_widgets(); ?>
</div>
<br class='clear' />
</div>
<br class="clear" />
</div>
<?php
$theme_sidebars = array();
foreach ( $wp_registered_sidebars as $sidebar => $registered_sidebar ) {
if ( false !== strpos( $registered_sidebar['class'], 'inactive-sidebar' ) || 'orphaned_widgets' == substr( $sidebar, 0, 16 ) ) {
$wrap_class = 'widgets-holder-wrap';
if ( !empty( $registered_sidebar['class'] ) )
$wrap_class .= ' ' . $registered_sidebar['class'];
示例8: block_output
/**
* The content for the content section.
*
* @since Client Dash 1.4
*/
public function block_output()
{
// Check to see if any plugin modifications have been made, and notify the user
$active_plugins = get_option('active_plugins');
$cd_active_plugins = get_option('cd_active_plugins');
if ($active_plugins != $cd_active_plugins) {
$dashboard_link = get_admin_url();
$dashboard_link = add_query_arg('cd_update_dash', 'true', $dashboard_link);
$dashboard_link = "<a href='{$dashboard_link}'>Dashboard</a>";
$this->error_nag("Hate to bother you, but one or more plugins has been activated / deactivated. Could you please visit the {$dashboard_link} to refresh the available widgets?");
return;
}
// WP API for widgets; required for use
require_once ABSPATH . 'wp-admin/includes/widgets.php';
// From wp-admin/widgets.php. Modified for CD use.
?>
<div id="cd-widgets">
<div class="widget-liquid-left">
<div id="widgets-left">
<div id="available-widgets" class="widgets-holder-wrap">
<div class="sidebar-name">
<div class="sidebar-name-arrow"><br/></div>
<h3><?php
_e('Available Widgets');
?>
<span
id="removing-widget"><?php
_ex('Deactivate', 'removing-widget');
?>
<span></span></span></h3>
</div>
<div class="widget-holder">
<div class="sidebar-description">
<p class="description"><?php
_e('To activate a widget drag it to a sidebar or click on it. To deactivate a widget and delete its settings, drag it back.');
?>
</p>
</div>
<div id="widget-list">
<?php
wp_list_widgets();
?>
</div>
<br class='clear'/>
</div>
<br class="clear"/>
</div>
</div>
</div>
<div class="widget-liquid-right">
<div id="widgets-right" class="single-sidebar">
<div class="sidebars-column-1">
<?php
$i = 0;
foreach ($this->sidebars as $sidebar) {
$wrap_class = 'widgets-holder-wrap';
if (!empty($registered_sidebar['class'])) {
$wrap_class .= ' sidebar-' . $registered_sidebar['class'];
}
if ($i > 0) {
$wrap_class .= ' closed';
}
?>
<div class="<?php
echo esc_attr($wrap_class);
?>
">
<?php
wp_list_widget_controls($sidebar['id'], $sidebar['name']);
?>
</div>
<?php
$i++;
}
?>
</div>
</div>
</div>
<form action="" method="post">
<?php
wp_nonce_field('save-sidebar-widgets', '_wpnonce_widgets', false);
?>
</form>
<br class="clear"/>
<div class="widgets-chooser">
<ul class="widgets-chooser-sidebars"></ul>
<div class="widgets-chooser-actions">
<button class="button-secondary"><?php
_e('Cancel');
?>
</button>
<button class="button-primary"><?php
//.........这里部分代码省略.........