本文整理汇总了PHP中get_edit_term_link函数的典型用法代码示例。如果您正苦于以下问题:PHP get_edit_term_link函数的具体用法?PHP get_edit_term_link怎么用?PHP get_edit_term_link使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_edit_term_link函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: init
public function init()
{
global $sitepress;
$tax_get = filter_input(INPUT_GET, 'taxonomy');
require ICL_PLUGIN_PATH . '/menu/term-taxonomy-menus/wpml-term-language-filter.class.php';
if (($trid = filter_input(INPUT_GET, 'trid')) && ($source_lang = filter_input(INPUT_GET, 'source_lang')) && get_taxonomy($tax_get) !== false) {
$translations = $sitepress->get_element_translations($trid, 'tax_' . $this->taxonomy);
if (isset($translations[$_GET['lang']]) && !empty($translations[$_GET['lang']]->term_id)) {
wp_redirect(get_edit_term_link($translations[$_GET['lang']]->term_id, $tax_get));
exit;
} else {
add_action('admin_notices', array($this, '_tax_adding'));
}
}
$term_lang_filter = new WPML_Term_Language_Filter(icl_get_setting('default_language'));
if ($this->taxonomy === 'category') {
add_action('edit_category_form', array($this, 'wpml_edit_term_form'));
} else {
add_action('add_tag_form', array($this, 'wpml_edit_term_form'));
add_action('edit_tag_form', array($this, 'wpml_edit_term_form'));
}
add_action('admin_print_scripts-edit-tags.php', array($this, 'js_scripts_tags'));
add_filter('wp_dropdown_cats', array($this, 'wp_dropdown_cats_select_parent'), 10, 2);
add_action('admin_footer', array($term_lang_filter, 'terms_language_filter'));
}
开发者ID:pcuervo,项目名称:odc,代码行数:25,代码来源:wpml-tax-menu-loader.class.php
示例2: ubik_terms_edit_link
function ubik_terms_edit_link($content = '', $class = '')
{
// Exit early if not logged in
if (!is_user_logged_in()) {
return;
}
// Fetch the current query object
$term = get_queried_object();
// Bail if something went wrong
if (!empty($term) && is_user_logged_in()) {
// Fetch the taxonomy and test the current user's capabilities
$tax = get_taxonomy($term->taxonomy);
if (empty($tax) || !current_user_can($tax->cap->edit_terms)) {
return;
}
// If we made it this far let's grab the raw edit term link
$link = get_edit_term_link($term->term_id, $term->taxonomy);
// Content
if (empty($content) || !is_string($content)) {
$content = __('Edit', 'ubik');
}
// Class
if (!empty($class)) {
$class = ' class="' . $class . '"';
}
// Put it all together
if (!empty($link)) {
return '<a href="' . $link . '"' . $class . ' rel="nofollow">' . $content . '</a>';
}
}
}
开发者ID:synapticism,项目名称:ubik-terms,代码行数:31,代码来源:ubik-terms-edit.php
示例3: uploaded_icon
public static function uploaded_icon($id)
{
$post_type = isset($GLOBALS['post_type']) ? $GLOBALS['post_type'] : $_REQUEST['post_type'];
// 2nd case for quick edit
$taxonomy = isset($GLOBALS['taxonomy']) ? $GLOBALS['taxonomy'] : $_REQUEST['taxonomy'];
$link = get_edit_term_link($id, $taxonomy, $post_type);
return self::display_icon('uploaded', $link);
}
开发者ID:Gordondalos,项目名称:expert,代码行数:8,代码来源:term-actions.php
示例4: get_admin_translation
/**
* Get term in backend
*
* @param array $term
* @param string $taxonomy
* @return array|bool
*/
private function get_admin_translation(array $term, $taxonomy)
{
if (!current_user_can('edit_terms', $taxonomy)) {
return FALSE;
}
$url = get_edit_term_link((int) $term['term_id'], $taxonomy);
return array('target_url' => new Mlp_Url($url), 'target_title' => $term['name']);
}
开发者ID:luisarn,项目名称:multilingual-press,代码行数:15,代码来源:Mlp_Term_Translation.php
示例5: column_name
function column_name($item)
{
$term_id = (int) $item->term_id;
$delete_url = add_query_arg('action', 'delete', get_edit_term_link($term_id, 'event-venue', 'event'));
//Build row actions
$actions = array('edit' => sprintf('<a href="%s">' . __('Edit') . '</a>', get_edit_term_link($term_id, 'event-venue', 'event')), 'delete' => sprintf('<a href="%s">' . __('Delete') . '</a>', wp_nonce_url($delete_url, 'eventorganiser_delete_venue_' . $item->slug)), 'view' => sprintf('<a href="%s">' . __('View') . '</a>', eo_get_venue_link($term_id)));
//Return the title contents
return sprintf('<a href="%1$s" class="row-title">%2$s</a>%3$s', get_edit_term_link($term_id, 'event-venue', 'event'), esc_html($item->name), $this->row_actions($actions));
}
开发者ID:Borgoroth,项目名称:Event-Organiser,代码行数:9,代码来源:class-eo-venue-list-table.php
示例6: test_cap_check_should_use_correct_taxonomy_when_taxonomy_is_not_specified
/**
* @ticket 35922
*/
public function test_cap_check_should_use_correct_taxonomy_when_taxonomy_is_not_specified()
{
register_taxonomy('wptests_tax_subscriber', 'post', array('manage_terms' => 'read'));
$t = self::factory()->term->create(array('taxonomy' => 'wptests_tax', 'name' => 'foo'));
$u = self::factory()->user->create(array('role' => 'subscriber'));
wp_set_current_user($u);
$actual = get_edit_term_link($t);
$this->assertNull($actual);
}
开发者ID:jaspermdegroot,项目名称:develop.wordpress,代码行数:12,代码来源:getEditTermLink.php
示例7: get_edit_link
protected function get_edit_link($term_id)
{
if (empty($term_id)) {
return null;
}
$url = get_edit_term_link($term_id, $this->config['args']['taxonomy']);
$result = \Cibulka::Base('HTML', 'a', array('target' => '_blank', 'href' => $url, 'class' => 'edit-link'), false, 'Upravit rubriku');
return $result;
}
开发者ID:cibulka,项目名称:cibulka-wp-plugin-forms,代码行数:9,代码来源:Term_Select.php
示例8: action_links
/**
* Add action links to Stream drop row in admin list screen
*
* @filter wp_stream_action_links_{connector}
* @param array $links Previous links registered
* @param int $record Stream record
* @return array Action links
*/
public static function action_links($links, $record)
{
if ($record->object_id && 'deleted' !== $record->action && ($term = get_term_by('term_taxonomy_id', $record->object_id, $record->context))) {
if (!is_wp_error($term)) {
$tax_obj = get_taxonomy($term->taxonomy);
$tax_label = isset($tax_obj->labels->singular_name) ? $tax_obj->labels->singular_name : null;
$links[sprintf(_x('Edit %s', 'Term singular name', 'stream'), $tax_label)] = get_edit_term_link($term->term_id, $term->taxonomy);
$links[__('View', 'stream')] = get_term_link($term->term_id, $term->taxonomy);
}
}
return $links;
}
开发者ID:xwp,项目名称:stream-legacy,代码行数:20,代码来源:taxonomies.php
示例9: action_links
/**
* Add action links to Stream drop row in admin list screen
*
* @filter wp_stream_action_links_{connector}
*
* @param array $links Previous links registered
* @param Record $record Stream record
*
* @return array Action links
*/
public function action_links($links, $record)
{
if ($record->object_id && 'deleted' !== $record->action && ($term = get_term_by('term_taxonomy_id', $record->object_id, $record->context))) {
if (!is_wp_error($term)) {
$tax_obj = get_taxonomy($term->taxonomy);
$tax_label = isset($tax_obj->labels->singular_name) ? $tax_obj->labels->singular_name : null;
if (function_exists('wp_get_split_term')) {
$term_id = wp_get_split_term($term->term_id, $term->taxonomy);
}
$term_id = empty($term_id) ? $term->term_id : $term_id;
$links[sprintf(_x('Edit %s', 'Term singular name', 'stream'), $tax_label)] = get_edit_term_link($term_id, $term->taxonomy);
$links[esc_html__('View', 'stream')] = wp_stream_is_vip() ? \wpcom_vip_get_term_link($term_id, $term->taxonomy) : get_term_link($term_id, $term->taxonomy);
}
}
return $links;
}
开发者ID:evgenykireev,项目名称:stream,代码行数:26,代码来源:class-connector-taxonomies.php
示例10: column_default
/**
* Print the columns information
*
* @param $rec \YITH_Commission
* @param $column_name
*
* @return string
*/
public function column_default($rec, $column_name)
{
switch ($column_name) {
case 'user':
if (empty($rec->display_name)) {
return "<em>" . __('User deleted', 'yith_wc_product_vendors') . "</em>";
}
$user_url = get_edit_user_link($rec->ID);
$user_name = $rec->display_name;
return !empty($user_url) ? "<a href='{$user_url}' target='_blank'>{$user_name}</a>" : $user_name;
break;
case 'vendor':
$vendor = yith_get_vendor($rec->ID, 'user');
if (!$vendor->is_valid()) {
return "<em>" . __('Vendor deleted', 'yith_wc_product_vendors') . "</em>";
}
$vendor_url = get_edit_term_link($vendor->id, $vendor->taxonomy);
$vendor_name = $vendor->name;
return !empty($vendor_url) ? "<a href='{$vendor_url}' target='_blank'>{$vendor_name}</a>" : $vendor_name;
break;
case 'amount':
$amount = get_user_meta($rec->ID, '_vendor_commission_credit', true);
return wc_price($amount);
break;
case 'user_actions':
if ($this->_vendor->is_super_user()) {
printf('<a class="button tips pay" href="%1$s" data-tip="%2$s">%2$s</a>', esc_url(wp_nonce_url(add_query_arg(array('action' => 'pay_commission', 'commission_id' => $rec->ID), admin_url('admin.php')), 'yith-vendors-pay-commission')), __('Pay', 'yith_wc_product_vendors'));
}
break;
case 'oldest_commission':
$commissions = YITH_Commissions()->get_commissions(array('user_id' => $rec->ID, 'fields' => 'last_edit', 'order' => 'ASC'));
$oldest_commission_date = array_shift($commissions);
$t_time = date_i18n(__('Y/m/d g:i:s A'), mysql2date('U', $oldest_commission_date));
$m_time = $oldest_commission_date;
$time = mysql2date('G', $oldest_commission_date);
$time_diff = time() - $time;
if ($time_diff > 0 && $time_diff < DAY_IN_SECONDS) {
$h_time = sprintf(__('%s ago'), human_time_diff($time));
} else {
$h_time = mysql2date(__('Y/m/d'), $m_time);
}
return $h_time ? '<abbr title="' . $t_time . '">' . $h_time . '</abbr>' : '<small class="meta">-</small>';
break;
}
return null;
}
开发者ID:kanhaiyasharma,项目名称:Bestswiss,代码行数:54,代码来源:class.yith-commissions-earnings-by-vendor-table.php
示例11: add_query_arg
}
if ($referer && false !== strpos($referer, 'edit-tags.php')) {
$location = $referer;
}
$location = add_query_arg('message', 6, $location);
break;
case 'edit':
if (!isset($_REQUEST['tag_ID'])) {
break;
}
$term_id = (int) $_REQUEST['tag_ID'];
$term = get_term($term_id);
if (!$term instanceof WP_Term) {
wp_die(__('You attempted to edit an item that doesn’t exist. Perhaps it was deleted?'));
}
wp_redirect(esc_url_raw(get_edit_term_link($term_id, $taxonomy, $post_type)));
exit;
case 'editedtag':
$tag_ID = (int) $_POST['tag_ID'];
check_admin_referer('update-tag_' . $tag_ID);
if (!current_user_can('edit_term', $tag_ID)) {
wp_die('<h1>' . __('Cheatin’ uh?') . '</h1>' . '<p>' . __('Sorry, you are not allowed to edit this item.') . '</p>', 403);
}
$tag = get_term($tag_ID, $taxonomy);
if (!$tag) {
wp_die(__('You attempted to edit an item that doesn’t exist. Perhaps it was deleted?'));
}
$ret = wp_update_term($tag_ID, $taxonomy, $_POST);
$location = 'edit-tags.php?taxonomy=' . $taxonomy;
if ('post' != $post_type) {
$location .= '&post_type=' . $post_type;
开发者ID:atimmer,项目名称:wordpress-develop-mirror,代码行数:31,代码来源:edit-tags.php
示例12: _eventorganiser_add_venue_admin_bar_edit_menu
function _eventorganiser_add_venue_admin_bar_edit_menu()
{
global $wp_admin_bar;
if (is_admin()) {
$current_screen = get_current_screen();
if ('event_page_venues' == $current_screen->base && isset($_GET['action']) && 'edit' == $_GET['action'] && ($tax = get_taxonomy('event-venue')) && $tax->public) {
$wp_admin_bar->add_menu(array('id' => 'view', 'title' => $tax->labels->view_item, 'href' => eo_get_venue_link($_GET['event-venue'])));
}
} else {
$current_object = get_queried_object();
if (!eo_is_venue()) {
return;
}
if (($tax = get_taxonomy($current_object->taxonomy)) && current_user_can($tax->cap->edit_terms)) {
$wp_admin_bar->add_menu(array('id' => 'edit', 'title' => $tax->labels->edit_item, 'href' => get_edit_term_link($current_object->term_id, $current_object->taxonomy)));
}
}
}
开发者ID:windyjonas,项目名称:fredrika,代码行数:18,代码来源:event-organiser-cpt.php
示例13: get_edit_link
/**
* Get link to edit a term
* @param int $value term id
* @return string
*/
public function get_edit_link($value)
{
$term = $this->get_term($value);
return sprintf('<a target="_new" class="fm-autocomplete-edit-link %s" href="%s">%s</a>', empty($value) ? 'fm-hidden' : '', empty($value) ? '#' : esc_url(get_edit_term_link($term->term_id, $term->taxonomy)), esc_html__('Edit', 'fieldmanager'));
}
开发者ID:gopinathshiva,项目名称:wordpress-vip-plugins,代码行数:10,代码来源:class-fieldmanager-datasource-term.php
示例14: wp_admin_bar_edit_menu
/**
* Provide an edit link for posts and terms.
*
* @since 3.1.0
*/
function wp_admin_bar_edit_menu($wp_admin_bar)
{
global $tag, $wp_the_query;
if (is_admin()) {
$current_screen = get_current_screen();
$post = get_post();
if ('post' == $current_screen->base && 'add' != $current_screen->action && ($post_type_object = get_post_type_object($post->post_type)) && current_user_can($post_type_object->cap->read_post, $post->ID) && $post_type_object->public && $post_type_object->show_in_admin_bar) {
$wp_admin_bar->add_menu(array('id' => 'view', 'title' => $post_type_object->labels->view_item, 'href' => get_permalink($post->ID)));
} elseif ('edit-tags' == $current_screen->base && isset($tag) && is_object($tag) && ($tax = get_taxonomy($tag->taxonomy)) && $tax->public) {
$wp_admin_bar->add_menu(array('id' => 'view', 'title' => $tax->labels->view_item, 'href' => get_term_link($tag)));
}
} else {
$current_object = $wp_the_query->get_queried_object();
if (empty($current_object)) {
return;
}
if (!empty($current_object->post_type) && ($post_type_object = get_post_type_object($current_object->post_type)) && current_user_can($post_type_object->cap->edit_post, $current_object->ID) && $post_type_object->show_ui && $post_type_object->show_in_admin_bar) {
$wp_admin_bar->add_menu(array('id' => 'edit', 'title' => $post_type_object->labels->edit_item, 'href' => get_edit_post_link($current_object->ID)));
} elseif (!empty($current_object->taxonomy) && ($tax = get_taxonomy($current_object->taxonomy)) && current_user_can($tax->cap->edit_terms) && $tax->show_ui) {
$wp_admin_bar->add_menu(array('id' => 'edit', 'title' => $tax->labels->edit_item, 'href' => get_edit_term_link($current_object->term_id, $current_object->taxonomy)));
}
}
}
开发者ID:jcsilkey,项目名称:CodeReviewSecurityRepo,代码行数:28,代码来源:admin-bar.php
示例15: column_name
function column_name($tag)
{
global $taxonomy, $tax, $post_type;
$default_term = get_option('default_' . $taxonomy);
$pad = str_repeat('— ', max(0, $this->level));
$name = apply_filters('term_name', $pad . ' ' . $tag->name, $tag);
$qe_data = get_term($tag->term_id, $taxonomy, OBJECT, 'edit');
$edit_link = get_edit_term_link($tag->term_id, $taxonomy, $post_type);
$out = '<strong><a class="row-title" href="' . $edit_link . '" title="' . esc_attr(sprintf(__('Edit “%s”'), $name)) . '">' . $name . '</a></strong><br />';
$actions = array();
if (current_user_can($tax->cap->edit_terms)) {
$actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit') . '</a>';
$actions['inline hide-if-no-js'] = '<a href="#" class="editinline">' . __('Quick Edit') . '</a>';
}
if (current_user_can($tax->cap->delete_terms) && $tag->term_id != $default_term) {
$actions['delete'] = "<a class='delete-tag' href='" . wp_nonce_url("edit-tags.php?action=delete&taxonomy={$taxonomy}&tag_ID={$tag->term_id}", 'delete-tag_' . $tag->term_id) . "'>" . __('Delete') . "</a>";
}
$actions = apply_filters('tag_row_actions', $actions, $tag);
$actions = apply_filters("{$taxonomy}_row_actions", $actions, $tag);
$out .= $this->row_actions($actions);
$out .= '<div class="hidden" id="inline_' . $qe_data->term_id . '">';
$out .= '<div class="name">' . $qe_data->name . '</div>';
$out .= '<div class="slug">' . apply_filters('editable_slug', $qe_data->slug) . '</div>';
$out .= '<div class="parent">' . $qe_data->parent . '</div></div></td>';
return $out;
}
开发者ID:Esleelkartea,项目名称:herramienta_para_autodiagnostico_ADEADA,代码行数:26,代码来源:class-wp-terms-list-table.php
示例16: column_default
/**
* Print the columns information
*
* @param $rec \YITH_Commission
* @param $column_name
*
* @return string
*/
public function column_default($rec, $column_name)
{
switch ($column_name) {
case 'commission_id':
$order = wc_get_order($rec->order_id);
$order ? printf('<a href="%s"><strong>#%d</strong></a>', $rec->get_view_url('admin'), $rec->id) : printf('<strong>#%d</strong>', $rec->id);
break;
case 'commission_status':
$display = $rec->get_status('display');
return "<mark data-tip='{$display}' class='{$rec->status} tips'>{$display}</mark>";
break;
case 'order_id':
/** @var WC_Order $order */
$order = wc_get_order($rec->order_id);
if (!$order) {
echo '<small class="meta">' . __('Order Deleted', 'yith_wc_product_vendors') . '</small>';
return;
}
if ($order->get_user_id()) {
$user_info = $order->get_user();
}
if (!empty($user_info)) {
$current_user_can = current_user_can('edit_users') || get_current_user_id() == $user_info->ID;
$username = $current_user_can ? '<a href="user-edit.php?user_id=' . absint($user_info->ID) . '">' : '';
if ($user_info->first_name || $user_info->last_name) {
$username .= esc_html(ucfirst($user_info->first_name) . ' ' . ucfirst($user_info->last_name));
} else {
$username .= esc_html(ucfirst($user_info->display_name));
}
if ($current_user_can) {
$username .= '</a>';
}
} else {
if ($order->billing_first_name || $order->billing_last_name) {
$username = trim($order->billing_first_name . ' ' . $order->billing_last_name);
} else {
$username = __('Guest', 'woocommerce');
}
}
$order_number = '<strong>#' . esc_attr($order->get_order_number()) . '</strong>';
$order_uri = '<a href="' . admin_url('post.php?post=' . absint($order->id) . '&action=edit') . '">' . $order_number . '</a>';
$order_info = $this->_vendor->is_super_user() ? $order_uri : $order_number;
printf(_x('%s by %s', 'Order number by user', 'yith_wc_product_vendors'), $order_info, $username);
if ($order->billing_email) {
echo '<small class="meta email"><a href="' . esc_url('mailto:' . $order->billing_email) . '">' . esc_html($order->billing_email) . '</a></small>';
}
do_action('yith_wpv_after_order_column', $order);
break;
case 'line_item':
$product = $rec->get_item();
if (!$product) {
return '<small class="meta">-</small>';
}
$product_url = get_edit_post_link($product['product_id']);
return !empty($product_url) ? "<a target='_blank' href='{$product_url}'><strong>{$product['name']}</strong></a>" : "<strong>{$product['name']}</strong>";
break;
case 'rate':
return $rec->rate * 100 . '%';
break;
case 'user':
$user = $rec->get_user();
if (empty($user)) {
return "<em>" . __('User deleted', 'yith_wc_product_vendors') . "</em>";
}
$user_url = get_edit_user_link($rec->user_id);
$user_name = $user->display_name;
return !empty($user_url) ? "<a href='{$user_url}' target='_blank'>{$user_name}</a>" : $user_name;
break;
case 'vendor':
$vendor = $rec->get_vendor();
if (!$vendor->is_valid()) {
return "<em>" . __('Vendor deleted', 'yith_wc_product_vendors') . "</em>";
}
$vendor_url = get_edit_term_link($vendor->id, $vendor->taxonomy);
$vendor_name = $vendor->name;
return !empty($vendor_url) ? "<a href='{$vendor_url}' target='_blank'>{$vendor_name}</a>" : $vendor_name;
break;
case 'amount':
return wc_price($rec->amount);
break;
case 'user_actions':
printf('<a class="button tips view" href="%1$s" data-tip="%2$s">%2$s</a>', $rec->get_view_url('admin'), __('View', 'yith_wc_product_vendors'));
break;
case 'date':
$date = $rec->get_date();
$t_time = date_i18n(__('Y/m/d g:i:s A'), mysql2date('U', $date));
$m_time = $date;
$time = mysql2date('G', $date);
$time_diff = time() - $time;
if ($time_diff > 0 && $time_diff < DAY_IN_SECONDS) {
$h_time = sprintf(__('%s ago'), human_time_diff($time));
} else {
//.........这里部分代码省略.........
开发者ID:tib07,项目名称:yith-woocommerce-product-vendors,代码行数:101,代码来源:class.yith-commissions-list-table.php
示例17: term_column
public function term_column($out, $column, $term_id)
{
$inline = defined('DOING_AJAX') && $_REQUEST['action'] == 'inline-save-tax' && isset($_POST['inline_lang_choice']);
if (false === strpos($column, 'language_') || !($lang = $inline ? $this->model->get_language($_POST['inline_lang_choice']) : $this->model->get_term_language($term_id))) {
return $out;
}
$post_type = isset($GLOBALS['post_type']) ? $GLOBALS['post_type'] : $_REQUEST['post_type'];
// 2nd case for quick edit
$taxonomy = isset($GLOBALS['taxonomy']) ? $GLOBALS['taxonomy'] : $_REQUEST['taxonomy'];
if (!post_type_exists($post_type) || !taxonomy_exists($taxonomy)) {
return $out;
}
$term_id = (int) $term_id;
$language = $this->model->get_language(substr($column, 9));
if ($column == $this->get_first_language_column()) {
$out = sprintf('<div class="hidden" id="lang_%d">%s</div>', $term_id, esc_html($lang->slug));
// identify the default categories to disable the language dropdown in js
if (in_array(get_option('default_category'), $this->model->get_translations('term', $term_id))) {
$out .= sprintf('<div class="hidden" id="default_cat_%1$d">%1$d</div>', $term_id);
}
}
// link to edit term (or a translation)
if (($id = $this->model->get_term($term_id, $language)) && ($term = get_term($id, $taxonomy))) {
$out .= sprintf('<a class="%1$s" title="%2$s" href="%3$s"></a>', $id == $term_id ? 'pll_icon_tick' : esc_attr('pll_icon_edit translation_' . $id), esc_attr($term->name), esc_url(get_edit_term_link($id, $taxonomy, $post_type)));
} else {
$out .= sprintf('<a class="pll_icon_add" title="%1$s" href="%2$s"></a>', __('Add new translation', 'polylang'), esc_url($this->links->get_new_term_translation_link($term_id, $taxonomy, $post_type, $language)));
}
return $out;
}
开发者ID:joostrijneveld,项目名称:cscircles-wp-content,代码行数:29,代码来源:admin-filters-columns.php
示例18: editTermLink
/**
* Returst Edit Term Link
*
* @param object $term
* @return string
*/
public static function editTermLink($term)
{
$st = mvb_Model_Helper::shortTitle($term->name);
$link = '<a href="' . get_edit_term_link($term->term_id, 'category') . '" target="_blank" title="' . esc_attr($term->name) . '">' . $st . '</a>';
return $link;
}
开发者ID:rosshettel,项目名称:Northern-Star-Blogs,代码行数:12,代码来源:mvb_model_helper.php
示例19: col_taxonomy
/**
* Output column data for a taxonomy's term names.
*
* @param string $taxonomy The taxonomy name
* @param array $args Optional array of arguments for this field
*/
public function col_taxonomy($taxonomy, array $args = array())
{
global $post;
$terms = get_the_terms($post, $taxonomy);
$tax = get_taxonomy($taxonomy);
if (is_wp_error($terms)) {
echo $terms->get_error_message();
return;
}
if (empty($terms)) {
echo '—';
return;
}
$out = array();
foreach ($terms as $term) {
if ($args['link']) {
switch ($args['link']) {
case 'view':
if ($tax->public) {
$out[] = sprintf('<a href="%1$s">%2$s</a>', get_term_link($term), $term->name);
} else {
$out[] = $term->name;
}
break;
case 'edit':
if (current_user_can($tax->cap->edit_terms)) {
$out[] = sprintf('<a href="%1$s">%2$s</a>', get_edit_term_link($term, $taxonomy, $post->post_type), $term->name);
} else {
$out[] = $term->name;
}
break;
case 'list':
$link = add_query_arg(array('post_type' => $post->post_type, $taxonomy => $term->slug), admin_url('edit.php'));
$out[] = sprintf('<a href="%1$s">%2$s</a>', $link, $term->name);
break;
}
} else {
$out[] = $term->name;
}
}
echo implode(', ', $out);
}
开发者ID:m-e-h,项目名称:doc-directory,代码行数:48,代码来源:extended-cpts.php
示例20: wp_tag_cloud
/**
* Display tag cloud.
*
* The text size is set by the 'smallest' and 'largest' arguments, which will
* use the 'unit' argument value for the CSS text size unit. The 'format'
* argument can be 'flat' (default), 'list', or 'array'. The flat value for the
* 'format' argument will separate tags with spaces. The list value for the
* 'format' argument will format the tags in a UL HTML list. The array value for
* the 'format' argument will return in PHP array type format.
*
* The 'orderby' argument will accept 'name' or 'count' and defaults to 'name'.
* The 'order' is the direction to sort, defaults to 'ASC' and can be 'DESC'.
*
* The 'number' argument is how many tags to return. By default, the limit will
* be to return the top 45 tags in the tag cloud list.
*
* The 'topic_count_text' argument is a nooped plural from _n_noop() to generate the
* text for the tooltip of the tag link.
*
* The 'topic_count_text_callback' argument is a function, which given the count
* of the posts with that tag returns a text for the tooltip of the tag link.
*
* The 'post_type' argument is used only when 'link' is set to 'edit'. It determines the post_type
* passed to edit.php for the popular tags edit links.
*
* The 'exclude' and 'include' arguments are used for the get_tags() function. Only one
* should be used, because only one will be used and the other ignored, if they are both set.
*
* @since 2.3.0
*
* @param array|string|null $args Optional. Override default arguments.
* @return void|array Generated tag cloud, only if no failures and 'array' is set for the 'format' argument.
* Otherwise, this function outputs the tag cloud.
*/
function wp_tag_cloud($args = '')
{
$defaults = array('smallest' => 8, 'largest' => 22, 'unit' => 'pt', 'number' => 45, 'format' => 'flat', 'separator' => "\n", 'orderby' => 'name', 'order' => 'ASC', 'exclude' => '', 'include' => '', 'link' => 'view', 'taxonomy' => 'post_tag', 'post_type' => '', 'echo' => true);
$args = wp_parse_args($args, $defaults);
$tags = get_terms($args['taxonomy'], array_merge($args, array('orderby' => 'count', 'order' => 'DESC')));
// Always query top tags
if (empty($tags) || is_wp_error($tags)) {
return;
}
foreach ($tags as $key => $tag) {
if ('edit' == $args['link']) {
$link = get_edit_term_link($tag->term_id, $tag->taxonomy, $args['post_type']);
} else {
$link = get_term_link(intval($tag->term_id), $tag->taxonomy);
}
if (is_wp_error($link)) {
return;
}
$tags[$key]->link = $link;
$tags[$key]->id = $tag->term_id;
}
$return = wp_generate_tag_cloud($tags, $args);
// Here's where those top tags get sorted according to $args
/**
* Filters the tag cloud output.
*
* @since 2.3.0
*
* @param string $return HTML output of the tag cloud.
* @param array $args An array of tag cloud arguments.
*/
$return = apply_filters('wp_tag_cloud', $return, $args);
if ('array' == $args['format'] || empty($args['echo'])) {
return $return;
}
echo $return;
}
开发者ID:CompositeUK,项目名称:clone.WordPress-Core,代码行数:71,代码来源:category-template.php
注:本文中的get_edit_term_link函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论