本文整理汇总了PHP中wp_category_checklist函数的典型用法代码示例。如果您正苦于以下问题:PHP wp_category_checklist函数的具体用法?PHP wp_category_checklist怎么用?PHP wp_category_checklist使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wp_category_checklist函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: render_content
public function render_content()
{
?>
<label>
<?php
if (!empty($this->label)) {
?>
<span class="customize-control-title">
<?php
echo esc_html($this->label);
?>
</span>
<?php
}
?>
<?php
if (!empty($this->description)) {
?>
<span class="description customize-control-description">
<?php
echo $this->description;
?>
</span>
<?php
}
?>
<div class="gk-portfolio-category-selection">
<ul>
<li class="gk-portfolio-fake-checkbox"><input type="checkbox" /></li>
<?php
wp_category_checklist(0, 0, explode(',', $this->value()), false, new Dziudek_TC_Walker_Category_Checklist($this->id), false);
?>
</ul>
<input type="hidden" id="<?php
echo $this->id;
?>
" class="gk-portfolio-category-selection-value" <?php
$this->link();
?>
value="<?php
echo sanitize_text_field($this->value());
?>
">
</div>
</label>
<?php
}
开发者ID:arildoosilva,项目名称:my_portfolio_site,代码行数:51,代码来源:category-selection.php
示例2: genesis_category_checklist
function genesis_category_checklist($name = '', $selected = array())
{
$name = esc_attr($name);
// home link
if (in_array('home', (array) $selected)) {
$checked = 'checked';
} else {
$checked = '';
}
$checkboxes = '<li><label class="selectit"><input type="checkbox" name="' . $name . '[]" value="home" ' . $checked . ' /> Home</label></li>' . "\n";
// categories
ob_start();
wp_category_checklist(0, 0, $selected, false, '', $checked_on_top = false);
$checkboxes .= str_replace('name="post_category[]"', 'name="' . $name . '[]"', ob_get_clean());
echo $checkboxes;
}
开发者ID:elderxavier,项目名称:ALLAN-JUNIOR-IAN,代码行数:16,代码来源:admin.php
示例3: fwp_category_checklist
function fwp_category_checklist($post_id = 0, $descendents_and_self = 0, $selected_cats = false)
{
if (function_exists('wp_category_checklist')) {
wp_category_checklist($post_id, $descendents_and_self, $selected_cats);
} else {
// selected_cats is an array of integer cat_IDs / term_ids for
// the categories that should be checked
global $post_ID;
$cats = get_nested_categories();
// Undo damage from usort() in WP 2.0
$dogs = array();
foreach ($cats as $cat) {
$dogs[$cat['cat_ID']] = $cat;
}
foreach ($selected_cats as $cat_id) {
$dogs[$cat_id]['checked'] = true;
}
write_nested_categories($dogs);
}
}
开发者ID:jcbozonier,项目名称:master,代码行数:20,代码来源:compatability.php
示例4: tumblrize_options
/**
* Provides plugin-wide options screen.
*
* TODO: Eventually, these options should be consolidated logically so as not
* to keep cluttering the database with Tumblrize options. Kind of messy.
*/
function tumblrize_options()
{
?>
<div class="wrap">
<h2><img src="http://id.ijulien.com/img/tumblrize.png" alt="Tumblrize" /></h2>
<form method="post" action="options.php">
<?php
wp_nonce_field('update-options');
?>
<?php
if (get_option('tumblrize_tumblr_email') == "") {
?>
<p>Enter your Tumblr email and password to enable Tumblrize to post updates.</p>
<?php
}
?>
<table class="form-table" summary="Tumblrize Plugin Options">
<tr valign="top">
<th scope="row"><label for="tumblrize_tumblr_email">Tumblr Email</label></th>
<td>
<input type="text" id="tumblrize_tumblr_email" name="tumblrize_tumblr_email" autocomplete="off" value="<?php
echo get_option('tumblrize_tumblr_email');
?>
" />
<span class="setting-description">Provide a default Tumblr account for authors to use to crosspost content.</span><br />
<span class="description">To force users to provide their own credentials, enter <code>NONE</code> here, and in the <em>Tumblr Password</em> field, below.</span>
</td>
</tr>
<tr valign="top">
<th scope="row"><label for="tumblrize_tumblr_password">Tumblr Password</label></th>
<td>
<input type="password" id="tumblrize_tumblr_password" name="tumblrize_tumblr_password" autocomplete="off" value="<?php
echo get_option('tumblrize_tumblr_password');
?>
" />
<span class="setting-description">Provide the password for the default Tumblr account.</span><br />
<span class="description">To force users to provide their own credentials, enter <code>NONE</code> here, and in the <em>Tumblr Email</em> field, above.</span>
</td>
</tr>
<tr valign="top">
<th scope="row"><label for="tumblrize_tumblr_group">Use Tumblr Group</label></th>
<td>
<input type="text" id="tumblrize_tumblr_group" name="tumblrize_tumblr_group" autocomplete="off" value="<?php
echo get_option('tumblrize_tumblr_group');
?>
" />
<span class="setting-description">Use a domain name; e.g., <code>my-other-blog.tumblr.com</code></span><br />
<span class="description">Send to this group on Tumblr by default. Leave blank to send to your default Tumblr blog instead. (Can be overriden on Write Post screen.)</span>
</td>
</tr>
<tr valign="top">
<th scope="row"><label for="tumblrize_shutoff">Turn Off Tumblrize</label></th>
<td>
<input type="checkbox" id="tumblrize_shutoff" name="tumblrize_shutoff" value="tumblrize_shutoff_on" <?php
if (get_option('tumblrize_shutoff') == "tumblrize_shutoff_on") {
echo 'checked="checked"';
}
?>
/>
<span class="description">Disables default crossposting to Tumblr, but will still crosspost to Posterous if "Also send to Posterous?" option is enabled. (Can also be overriden on a per-post basis.)</span>
</td>
</tr>
<tr valign="top">
<th scope="row"><label for="tumblrize_exclude_cats">Do not crosspost entries in these categories:</label></th>
<td>
<span class="description">Will cause posts in the specificied categories never to be crossposted to Tumblr. This is useful if, for instance, you are creating posts automatically using another plugin and wish to avoid a feedback loop of crossposting back and forth from one service to another.</span>
<?php
// TODO: Make this not such a terrible hack job. Really.
ob_start();
?>
<ul><?php
print wp_category_checklist(0, 0, get_option('tumblrize_exclude_cats'));
?>
</ul>
<?php
$out = ob_get_contents();
// Change form appropriately.
$out = preg_replace('/post_category\\[]/', 'tumblrize_exclude_cats[]', $out);
ob_end_clean();
// But hey...this hack job totally works for now.
print $out;
?>
</td>
</tr>
<tr valign="top">
<th scope="row">
<label for="tumblrize_tumblr_posterous">Also send to <a href="http://www.posterous.com/" title="Posterous">Posterous</a>?</label>
//.........这里部分代码省略.........
开发者ID:arturo-mayorga,项目名称:am_com,代码行数:101,代码来源:tumblrize.php
示例5: HtmlShowOptionsPage
//.........这里部分代码省略.........
<?php
_e('Include author pages', 'sitemap');
?>
</label>
</li>
</ul>
<?php
$this->HtmlPrintBoxFooter();
?>
<!-- Excluded Items -->
<?php
$this->HtmlPrintBoxHeader('sm_excludes', __('Excluded items', 'sitemap'));
?>
<b><?php
_e('Excluded categories', 'sitemap');
?>
:</b>
<?php
if (version_compare($wp_version, "2.5.1", ">=")) {
?>
<cite style="display:block; margin-left:40px;"><?php
_e("Note", "sitemap");
?>
: <?php
_e("Using this feature will increase build time and memory usage!", "sitemap");
?>
</cite>
<div style="border-color:#CEE1EF; border-style:solid; border-width:2px; height:10em; margin:5px 0px 5px 40px; overflow:auto; padding:0.5em 0.5em;">
<ul>
<?php
wp_category_checklist(0, 0, $this->sg->GetOption("b_exclude_cats"), false);
?>
</ul>
</div>
<?php
} else {
?>
<ul><li><?php
echo sprintf(__("This feature requires at least WordPress 2.5.1, you are using %s", "sitemap"), $wp_version);
?>
</li></ul>
<?php
}
?>
<b><?php
_e("Exclude posts", "sitemap");
?>
:</b>
<div style="margin:5px 0 13px 40px;">
<label for="sm_b_exclude"><?php
_e('Exclude the following posts or pages:', 'sitemap');
?>
<small><?php
_e('List of IDs, separated by comma', 'sitemap');
?>
</small><br />
<input name="sm_b_exclude" id="sm_b_exclude" type="text" style="width:400px;" value="<?php
echo implode(",", $this->sg->GetOption("b_exclude"));
?>
" /></label><br />
<cite><?php
_e("Note", "sitemap");
开发者ID:SymbiSoft,项目名称:litprojects,代码行数:67,代码来源:sitemap-ui.php
示例6: HtmlShowOptionsPage
//.........这里部分代码省略.........
?>
</label><br />
<small><?php
_e('This is highly recommended and helps the search engines to know when your content has changed. This option affects <i>all</i> sitemap entries.', 'sitemap');
?>
</small>
</li>
</ul>
<?php
$this->HtmlPrintBoxFooter();
?>
<!-- Excluded Items -->
<?php
$this->HtmlPrintBoxHeader('sm_excludes', __('Excluded items', 'sitemap'));
?>
<b><?php
_e('Excluded categories', 'sitemap');
?>
:</b>
<cite style="display:block; margin-left:40px;"><?php
_e("Note", "sitemap");
?>
: <?php
_e("Using this feature will increase build time and memory usage!", "sitemap");
?>
</cite>
<div style="border-color:#CEE1EF; border-style:solid; border-width:2px; height:10em; margin:5px 0px 5px 40px; overflow:auto; padding:0.5em 0.5em;">
<ul>
<?php
wp_category_checklist(0, 0, $this->sg->GetOption("b_exclude_cats"), false);
?>
</ul>
</div>
<b><?php
_e("Exclude posts", "sitemap");
?>
:</b>
<div style="margin:5px 0 13px 40px;">
<label for="sm_b_exclude"><?php
_e('Exclude the following posts or pages:', 'sitemap');
?>
<small><?php
_e('List of IDs, separated by comma', 'sitemap');
?>
</small><br />
<input name="sm_b_exclude" id="sm_b_exclude" type="text" style="width:400px;" value="<?php
echo esc_attr(implode(",", $this->sg->GetOption("b_exclude")));
?>
" /></label><br />
<cite><?php
_e("Note", "sitemap");
?>
: <?php
_e("Child posts won't be excluded automatically!", "sitemap");
?>
</cite>
</div>
<?php
$this->HtmlPrintBoxFooter();
?>
开发者ID:songsanren,项目名称:My-blog,代码行数:67,代码来源:sitemap-ui.php
示例7: _e
_e('Click to toggle');
?>
">
<br/>
</div>
<h3><?php
_e('Categories');
?>
</h3>
<div class="inside">
<div id="categories-all" class="tabs-panel">
<ul id="categorychecklist" class="list:category categorychecklist form-no-clear">
<?php
wp_category_checklist($post_ID, false);
?>
</ul>
</div>
<div id="category-adder" class="wp-hidden-children">
<a id="category-add-toggle" href="#category-add" class="hide-if-no-js" tabindex="3"><?php
_e('+ Add New Category');
?>
</a>
<p id="category-add" class="wp-hidden-child">
<label class="screen-reader-text" for="newcat"><?php
_e('Add New Category');
?>
</label><input type="text" name="newcat" id="newcat" class="form-required form-input-tip" value="<?php
esc_attr_e('New category name');
开发者ID:xiaoxiaoleo,项目名称:yihe,代码行数:31,代码来源:press-this.php
示例8: _mw_adminimize_sidecat_list_category_box
/**
* list category-box in sidebar
*
* @uses $post_ID
*/
function _mw_adminimize_sidecat_list_category_box()
{
global $post_ID;
?>
<div class="inside" id="categorydivsb">
<p><strong><?php
_e("Categories");
?>
</strong></p>
<ul id="categorychecklist" class="list:category categorychecklist form-no-clear">
<?php
wp_category_checklist($post_ID);
?>
</ul>
<?php
if (!defined('WP_PLUGIN_DIR')) {
// for wp <2.6
?>
<div id="category-adder" class="wp-hidden-children">
<h4><a id="category-add-toggle" href="#category-add" class="hide-if-no-js" tabindex="3"><?php
_e('+ Add New Category');
?>
</a></h4>
<p id="category-add" class="wp-hidden-child">
<input type="text" name="newcat" id="newcat" class="form-required form-input-tip" value="<?php
_e('New category name');
?>
" tabindex="3" />
<?php
wp_dropdown_categories(array('hide_empty' => 0, 'name' => 'newcat_parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => __('Parent category'), 'tab_index' => 3));
?>
<input type="button" id="category-add-sumbit" class="add:categorychecklist:category-add button" value="<?php
_e('Add');
?>
" tabindex="3" />
<?php
wp_nonce_field('add-category', '_ajax_nonce', FALSE);
?>
<span id="category-ajax-response"></span>
</p>
</div>
<?php
} else {
?>
<div id="category-adder" class="wp-hidden-children">
<h4><a id="category-add-toggle" href="#category-add" class="hide-if-no-js" tabindex="3"><?php
_e('+ Add New Category');
?>
</a></h4>
<p id="category-add" class="wp-hidden-child">
<label class="hidden" for="newcat"><?php
_e('Add New Category');
?>
</label><input type="text" name="newcat" id="newcat" class="form-required form-input-tip" value="<?php
_e('New category name');
?>
" tabindex="3" aria-required="TRUE" />
<br />
<label class="hidden" for="newcat_parent"><?php
_e('Parent category');
?>
:</label><?php
wp_dropdown_categories(array('hide_empty' => 0, 'name' => 'newcat_parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => __('Parent category'), 'tab_index' => 3));
?>
<input type="button" id="category-add-sumbit" class="add:categorychecklist:category-add button" value="<?php
_e('Add');
?>
" tabindex="3" />
<?php
wp_nonce_field('add-category', '_ajax_nonce', FALSE);
?>
<span id="category-ajax-response"></span>
</p>
</div>
<?php
}
?>
</div>
<?php
}
开发者ID:Kilbourne,项目名称:restart,代码行数:88,代码来源:adminimize.php
示例9: options_panel
//.........这里部分代码省略.........
</div>
<?php
if ($this->is_category_permalinks()) {
?>
<style>
#category-allow ul.children { margin-left: 20px; }
</style>
<form method="post" action="">
<?php
wp_nonce_field('fv_top_level_cats');
?>
<div id="poststuff" class="ui-sortable">
<div class="postbox">
<h3>
<?php
_e('Adjust categories in your post URLs', 'fv_tlc');
?>
</h3>
<div class="inside">
<table class="form-table">
<tr>
<td>
<label for="top-level-only">
<input type="checkbox" name="top-level-only" id="top-level-only" value="1" <?php
if (isset($options['top-level-only'])) {
if ($options['top-level-only']) {
echo 'checked="checked"';
}
}
?>
/>
<?php
_e('Only use top-level categories in URLs.', 'fv_tlc');
?>
</label>
</td>
</tr>
<tr>
<td>
<label for="category-allow-enabled">
<input type="checkbox" name="category-allow-enabled" id="category-allow-enabled" value="1" <?php
if (isset($options['category-allow-enabled'])) {
if ($options['category-allow-enabled']) {
echo 'checked="checked"';
}
}
?>
/>
<?php
_e('Only allow following categories in URLs:', 'fv_tlc');
?>
</label>
<blockquote>
<ul id="category-allow"> <?php
if (isset($options['category-allow'])) {
$descendants_and_self = $options['category-allow'];
} else {
$descendants_and_self = 0;
//wp default value
}
wp_category_checklist(0, 0, $descendants_and_self, false, null, false);
?>
</ul>
</blockquote>
</td>
</tr>
</table>
<p>
<input type="submit" name="fv_top_level_cats_submit" class="button-primary" value="<?php
_e('Save Changes', 'fv_tlc');
?>
" />
</p>
</div>
</div>
<p><?php
_e('Are you having any problems or questions? Use our <a target="_blank" href="http://foliovision.com/support/fv-top-level-categories/">support forums</a>.', 'fv_tlc');
?>
</p>
</div>
</form>
<?php
} else {
?>
<p><?php
_e('Since you are not using %category% in your post permalinks, there is nothing to adjust.', 'fv_tlc');
?>
</p>
<?php
}
?>
</div>
<?php
}
开发者ID:conscious-jp,项目名称:website,代码行数:101,代码来源:top-level-cats.php
示例10: array
$add = array('what' => 'category', 'id' => $cat_id, 'data' => str_replace(array("\n", "\t"), '', $data), 'position' => -1);
}
if ($parent) {
// Foncy - replace the parent and all its children
$parent = get_category($parent);
$term_id = $parent->term_id;
while ($parent->parent) {
// get the top parent
$parent =& get_category($parent->parent);
if (is_wp_error($parent)) {
break;
}
$term_id = $parent->term_id;
}
ob_start();
wp_category_checklist(0, $term_id, $checked_categories, $popular_ids, null, false);
$data = ob_get_contents();
ob_end_clean();
$add = array('what' => 'category', 'id' => $term_id, 'data' => str_replace(array("\n", "\t"), '', $data), 'position' => -1);
}
ob_start();
wp_dropdown_categories(array('hide_empty' => 0, 'name' => 'newcat_parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => __('Parent category')));
$sup = ob_get_contents();
ob_end_clean();
$add['supplemental'] = array('newcat_parent' => $sup);
$x = new WP_Ajax_Response($add);
$x->send();
break;
case 'add-link-category':
// On the Fly
check_ajax_referer($action);
开发者ID:nagyist,项目名称:laura-wordpress,代码行数:31,代码来源:admin-ajax.php
示例11: printOptions
/**
* Ouput formatted options
*
* @param array $option_data
* @return string
*/
function printOptions($option_data, $option_actual)
{
// Generate output
$output = '';
$output .= "\n" . '<table class="form-table avhec-options">' . "\n";
foreach ($option_data as $option) {
$section = substr($option[0], strpos($option[0], '[') + 1);
$section = substr($section, 0, strpos($section, ']['));
$option_key = rtrim($option[0], ']');
$option_key = substr($option_key, strpos($option_key, '][') + 2);
// Helper
if ($option[2] == 'helper') {
$output .= '<tr style="vertical-align: top;"><td class="helper" colspan="2">' . wp_filter_post_kses($option[4]) . '</td></tr>' . "\n";
continue;
}
switch ($option[2]) {
case 'checkbox':
$input_type = '<input type="checkbox" id="' . esc_attr($option[0]) . '" name="' . esc_attr($option[0]) . '" value="' . esc_attr($option[3]) . '" ' . $this->isChecked('1', $option_actual[$section][$option_key]) . ' />' . "\n";
$explanation = $option[4];
break;
case 'dropdown':
$selvalue = $option[3];
$seltext = $option[4];
$seldata = '';
foreach ((array) $selvalue as $key => $sel) {
$seldata .= '<option value="' . esc_attr($sel) . '" ' . ($option_actual[$section][$option_key] == $sel ? 'selected="selected"' : '') . ' >' . esc_html(ucfirst($seltext[$key])) . '</option>' . "\n";
}
$input_type = '<select id="' . esc_attr($option[0]) . '" name="' . esc_attr($option[0]) . '">' . $seldata . '</select>' . "\n";
$explanation = $option[5];
break;
case 'text-color':
$input_type = '<input type="text" ' . ($option[3] > 1 ? ' style="width: 95%" ' : '') . 'id="' . esc_attr($option[0]) . '" name="' . esc_attr($option[0]) . '" value="' . esc_attr($option_actual[$section][$option_key]) . '" size="' . esc_attr($option[3]) . '" /><div class="box_color ' . esc_attr($option[0]) . '"></div>' . "\n";
$explanation = $option[4];
break;
case 'textarea':
$input_type = '<textarea rows="' . esc_attr($option[5]) . '" ' . ($option[3] > 1 ? ' style="width: 95%" ' : '') . 'id="' . esc_attr($option[0]) . '" name="' . esc_attr($option[0]) . '" size="' . esc_attr($option[3]) . '" />' . $option_actual[$section][$option_key] . '</textarea>';
$explanation = $option[4];
break;
case 'catlist':
ob_start();
echo '<div id="avhec-catlist">';
echo '<ul>';
wp_category_checklist(0, 0, $option_actual[$section][$option_key]);
echo '</ul>';
echo '</div>';
$input_type = ob_get_contents();
ob_end_clean();
$explanation = $option[4];
break;
case 'text':
default:
$input_type = '<input type="text" ' . ($option[3] > 1 ? ' style="width: 95%" ' : '') . 'id="' . esc_attr($option[0]) . '" name="' . esc_attr($option[0]) . '" value="' . esc_attr($option_actual[$section][$option_key]) . '" size="' . esc_attr($option[3]) . '" />' . "\n";
$explanation = $option[4];
break;
}
// Additional Information
$extra = '';
if ($explanation) {
$extra = '<br /><span class="description">' . wp_filter_kses($explanation) . '</span>' . "\n";
}
// Output
$output .= '<tr style="vertical-align: top;"><th align="left" scope="row"><label for="' . esc_attr($option[0]) . '">' . wp_filter_kses($option[1]) . '</label></th><td>' . $input_type . ' ' . $extra . '</td></tr>' . "\n";
}
$output .= '</table>' . "\n";
return $output;
}
开发者ID:nhatnam1102,项目名称:wp-content,代码行数:72,代码来源:avh-ec.admin.php
示例12: display_event_page
//.........这里部分代码省略.........
<select id="date-end-ampm" name="date-end-ampm">
<option value="am" <?php
if ($endtimeampm == 'am') {
?>
selected="selected"<?php
}
?>
>am</option>
<option value="pm" <?php
if ($endtimeampm == 'pm') {
?>
selected="selected"<?php
}
?>
>pm</option>
</select>
</td>
</tr>
</table>
</div> <!-- panes -->
</div>
</td>
</tr>
<tr valign="top">
<th scope="row">Categories:</th>
<td>
<div id="categories-all" class="ui-tabs-panel">
<ul id="categorychecklist" class="list:category categorychecklist form-no-clear">
<?php
$eventcategories = $this->get_event_categories($this->eventId);
wp_category_checklist(0, false, $eventcategories);
?>
</ul>
</div>
</td>
</tr>
<tr valign="top">
<th scope="row">Address:</th>
<td><input type="text" name="address" value="<?php
echo $this->eventInfo->address;
?>
" size="40" /></td>
</tr>
<tr valign="top">
<th scope="row">City:</th>
<td><input type="text" name="city" value="<?php
echo $this->eventInfo->city;
?>
" size="40" /></td>
</tr>
<tr valign="top">
<th scope="row">State:</th>
<td><input type="text" name="state" value="<?php
echo $this->eventInfo->state;
?>
" size="2" maxlength="2" /></td>
</tr>
<tr valign="top">
<th scope="row">Zip:</th>
<td><input type="text" name="zip" value="<?php
echo $this->eventInfo->zip;
?>
" size="6" maxlength="6" /></td>
开发者ID:vanie3,项目名称:sierrahr,代码行数:67,代码来源:eventmanager.class.php
示例13: form
/**
* Displays the form for this widget on the Widgets page of the WP Admin area.
*
* @param array An array of the current settings for this widget
* @return void Echoes it's output
**/
function form($instance)
{
$instance = wp_parse_args((array) $instance, array('title' => __('Photo', 'dw_focus'), 'row' => 2, 'category' => 0));
$title = esc_html($instance['title']);
?>
<p><label for="<?php
echo $this->get_field_id('title');
?>
"><?php
_e('Widget titlte', 'dw_focus');
?>
</label>
<input type="text" name="<?php
echo $this->get_field_name('title');
?>
" id="<?php
echo $this->get_field_id('title');
?>
" class="widefat" value="<?php
echo trim($instance['title']);
?>
" >
</p>
<p><label for="<?php
echo $this->get_field_id('row');
?>
"><?php
_e('Widget row', 'dw_focus');
?>
</label>
<input class="widefat" type="text" name="<?php
echo $this->get_field_name('row');
?>
" id="<?php
echo $this->get_field_id('row');
?>
" value="<?php
echo $instance['row'];
?>
" > </p>
<div class="categories-checklist-container">
<p>
<label for="<?php
echo $this->get_field_id('category');
?>
">
<?php
_e('Current categories: ', 'dw_focus');
?>
<span class="description">
<?php
if (!empty($instance['category']) && is_array($instance['category'])) {
foreach ($instance['category'] as $cat) {
$cat_obj = get_category($cat);
echo $cat_obj->name . ', ';
}
}
?>
</span><br>
<span class="widefat category-pseudo-select"> <?php
_e('Select Categories', 'dw_focus');
?>
</span>
</label>
</p>
<ul class="categories-checklist">
<?php
$walker = new DW_Walker_Category_Checklist($this->get_field_name('category'));
wp_category_checklist(0, 0, $instance['category'], false, $walker, false);
?>
</ul>
</div>
<?php
}
开发者ID:aromis,项目名称:dw-focus,代码行数:83,代码来源:dw-focus-photo-gallery.php
示例14: WP_Ajax_Response
$x = new WP_Ajax_Response();
foreach ($names as $cat_name) {
$cat_name = trim($cat_name);
$category_nicename = sanitize_title($cat_name);
if ('' === $category_nicename) {
continue;
}
$cat_id = wp_create_category($cat_name, $parent);
$checked_categories[] = $cat_id;
if ($parent) {
// Do these all at once in a second
continue;
}
$category = get_category($cat_id);
ob_start();
wp_category_checklist(0, $cat_id, $checked_categories);
$data = ob_get_contents();
ob_end_clean();
$x->add(array('what' => 'category', 'id' => $cat_id, 'data' => $data, 'position' => -1));
}
if ($parent) {
// Foncy - replace the parent and all its children
$parent = get_category($parent);
ob_start();
dropdown_categories(0, $parent);
$data = ob_get_contents();
ob_end_clean();
$x->add(array('what' => 'category', 'id' => $parent->term_id, 'old_id' => $parent->term_id, 'data' => $data, 'position' => -1));
}
$x->send();
break;
开发者ID:staylor,项目名称:develop.svn.wordpress.org,代码行数:31,代码来源:admin-ajax.php
示例15: capa_sublevel_roles
function capa_sublevel_roles()
{
// Check if POST isnt empty
$_POST ? capa_handle_action() : NULL;
/**
TODO wp_get_nav_menus( array('orderby' => 'name') ) Rights
*/
/*
<ul class="subsubsub">
<li><a href='upload.php' class="current">All <span class="count">(116)</span></a> |</li>
<li><a href='upload.php?post_mime_type=image'>Images <span class="count">(102)</span></a> |</li>
<li><a href='upload.php?post_mime_type=audio'>Audio <span class="count">(4)</span></a> |</li>
<li><a href="upload.php?detached=1">Unattached <span class="count">(8)</span></a></li></ul>
*/
echo '<div class="wrap">';
// For WP < 27
echo function_exists('screen_icon') ? screen_icon('users') : NULL;
echo '<h2 style="margin-bottom:15px;">' . __('CaPa » Users Roles', 'capa') . '</h2>';
// --------------------------------------------------------------
$categorys = get_categories(array('sort_column' => 'menu_order', 'hide_empty' => 0, 'child_of' => 0, 'hierarchical' => 0));
$category_check_role_editor = get_option("capa_protect_cat_role_editor");
$category_check_role_author = get_option("capa_protect_cat_role_author");
$category_check_role_contributor = get_option("capa_protect_cat_role_contributor");
$category_check_role_subscriber = get_option("capa_protect_cat_role_subscriber");
$category_check_role_visitor = get_option("capa_protect_cat_anonymous");
$pages = get_pages(array('sort_column' => 'menu_order'));
$page_check_role_editor = get_option("capa_protect_pag_role_editor");
$page_check_role_author = get_option("capa_protect_pag_role_author");
$page_check_role_contributor = get_option("capa_protect_pag_role_contributor");
$page_check_role_subscriber = get_option("capa_protect_pag_role_subscriber");
$page_check_role_visitor = get_option("capa_protect_pag_anonymous");
$odd[0] = '';
$odd[1] = ' class="alternate"';
echo '<ul class="subsubsub" style="float:none;">';
echo '<li><a href="#capa-scroll-category">' . _n('Category', 'Categories', count($categorys), 'capa') . '</a> | </li>';
echo '<li><a href="#capa-scroll-page">' . _n('Page', 'Pages', count($pages), 'capa') . '</a></li>';
# |
# echo '<li><a href="#capa-scroll-redirect">'._n('Redirect','Redirects', 0, 'capa').'</a></li>';
echo '</ul>';
echo '<form name="capa_protect" method="post">';
// --------------------------------------------------------------
// ---- Categories --- //
// --------------------------------------------------------------
echo '<a name="capa-scroll-category"></a>';
echo '<h2 style="margin-bottom:15px;">' . _n('Category visibility', 'Categories visibility', count($categorys), 'capa') . '<br><span class="description">' . __('Select which categories are available for each user role.', 'capa') . '</span></h2>';
echo '
<table class="widefat fixed capa-table">
<thead>
<tr>
<th> </th>
<th style="text-align:center;">' . __('Administrator', 'capa') . '</th>
<th style="text-align:center;">' . __('Editor', 'capa') . '</th>
<th style="text-align:center;">' . __('Author', 'capa') . '</th>
<th style="text-align:center;">' . __('Contributor', 'capa') . '</th>
<th style="text-align:center;">' . __('Subscriber', 'capa') . '</th>
<th style="text-align:center;">' . __('Visitor', 'capa') . '</th>
</tr>
</thead>
<tfoot>
<tr>
<th> ' . __('check/uncheck', 'capa') . ' </th>
<th> </th>
<th> <input type="checkbox" id="check-cat-editor" onclick="capa_check(\'capa_protect_cat[editor][]\',\'check-cat-editor\');"> </th>
<th> <input type="checkbox" id="check-cat-author" onclick="capa_check(\'capa_protect_cat[author][]\',\'check-cat-author\');"> </th>
<th> <input type="checkbox" id="check-cat-contributor" onclick="capa_check(\'capa_protect_cat[contributor][]\',\'check-cat-contributor\');"> </th>
<th> <input type="checkbox" id="check-cat-subscriber" onclick="capa_check(\'capa_protect_cat[subscriber][]\',\'check-cat-subscriber\');"> </th>
<th> <input type="checkbox" id="check-cat-visitor" onclick="capa_check(\'capa_protect_cat[visitor][]\',\'check-cat-visitor\');"> </th>
</tr>
</tfoot>
<tbody class="capa-tbody">
';
foreach ($categorys as $id => $cat) {
$raw_order[$cat->term_id] = $id;
$search[$cat->term_id] = $cat->category_parent;
}
// Get children-lvl
foreach ($categorys as $id => $cat) {
$lvl['cat'][$cat->term_id] = capa_find_lvl($cat->term_id, $search);
}
// Get category menu_order
ob_start();
wp_category_checklist();
$cat_output = ob_get_contents();
ob_end_clean();
preg_match_all("#category-(?P<id>(\\d+))'( |>)#isU", $cat_output, $sort_order, PREG_PATTERN_ORDER);
$sort_order = $sort_order['id'];
$i = 0;
#str_repeat( '— ', $lvl['cat'][$categorys[$raw_order[$id]]->term_id] )
#'.(($lvl['cat'][$categorys[$raw_order[$id]]->term_id] > 0) ? 'style="padding-left: '.$lvl['cat'][$categorys[$raw_order[$id]]->term_id].'5px;"' : '').'
foreach ($sort_order as $key => $id) {
echo '<tr style="text-align:center;" ' . $odd[$i % 2] . '>';
echo '<th><input type="hidden" id="empty-' . $categorys[$raw_order[$id]]->slug . '" name="empty" value="0" readonly><label onclick="capa_check_slug(\'' . $categorys[$raw_order[$id]]->slug . '-' . $categorys[$raw_order[$id]]->term_id . '\',\'empty-' . $categorys[$raw_order[$id]]->slug . '\');">' . str_repeat('<span style="color:#21759B;">›</span> ', $lvl['cat'][$categorys[$raw_order[$id]]->term_id]) . $categorys[$raw_order[$id]]->cat_name . '</label></th>';
echo '<td><input class="category_id_role" type="checkbox" DISABLED></td>';
echo '<td><input class="category_id_role ' . $categorys[$raw_order[$id]]->slug . '-' . $categorys[$raw_order[$id]]->term_id . '" type="checkbox" name="capa_protect_cat[editor][]" value="' . $categorys[$raw_order[$id]]->term_id . '" ' . (isset($category_check_role_editor[$categorys[$raw_order[$id]]->term_id]) ? 'checked' : NULL) . '></td>';
echo '<td><input class="category_id_role ' . $categorys[$raw_order[$id]]->slug . '-' . $categorys[$raw_order[$id]]->term_id . '" type="checkbox" name="capa_protect_cat[author][]" value="' . $categorys[$raw_order[$id]]->term_id . '" ' . (isset($category_check_role_author[$categorys[$raw_order[$id]]->term_id]) ? 'checked' : NULL) . '></td>';
echo '<td><input class="category_id_role ' . $categorys[$raw_order[$id]]->slug . '-' . $categorys[$raw_order[$id]]->term_id . '" type="checkbox" name="capa_protect_cat[contributor][]" value="' . $categorys[$raw_order[$id]]->term_id . '" ' . (isset($category_check_role_contributor[$categorys[$raw_order[$id]]->term_id]) ? 'checked' : NULL) . '><
|
请发表评论