本文整理汇总了PHP中link_cat_row函数的典型用法代码示例。如果您正苦于以下问题:PHP link_cat_row函数的具体用法?PHP link_cat_row怎么用?PHP link_cat_row使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了link_cat_row函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
?>
</tr>
</tfoot>
<tbody id="the-list" class="list:link-cat">
<?php
$start = ($pagenum - 1) * $catsperpage;
$args = array('offset' => $start, 'number' => $catsperpage, 'hide_empty' => 0);
if (!empty($_GET['s'])) {
$args['search'] = $_GET['s'];
}
$categories = get_terms('link_category', $args);
if ($categories) {
$output = '';
foreach ($categories as $category) {
$output .= link_cat_row($category);
}
echo $output;
unset($category);
}
?>
</tbody>
</table>
<div class="tablenav">
<?php
if ($page_links) {
echo "<div class='tablenav-pages'>{$page_links}</div>";
}
?>
示例2: check_ajax_referer
// From Blogroll -> Categories
check_ajax_referer('add-link-category');
if (!current_user_can('manage_categories')) {
die('-1');
}
if ('' === trim($_POST['name'])) {
$x = new WP_Ajax_Response(array('what' => 'link-cat', 'id' => new WP_Error('name', __('You did not enter a category name.'))));
$x->send();
}
$r = wp_insert_term($_POST['name'], 'link_category', $_POST);
if (is_wp_error($r)) {
$x = new WP_AJAX_Response(array('what' => 'link-cat', 'id' => $r));
$x->send();
}
extract($r, EXTR_SKIP);
if (!($link_cat = link_cat_row($term_id))) {
die('0');
}
$x = new WP_Ajax_Response(array('what' => 'link-cat', 'id' => $term_id, 'data' => $link_cat));
$x->send();
break;
case 'add-tag':
// From Manage->Tags
check_ajax_referer('add-tag');
if (!current_user_can('manage_categories')) {
die('-1');
}
if ('' === trim($_POST['name'])) {
$x = new WP_Ajax_Response(array('what' => 'tag', 'id' => new WP_Error('name', __('You did not enter a tag name.'))));
$x->send();
}
示例3: get_category
if (isset($_POST['parent']) && (int) $_POST['parent'] > 0) {
$data['category_parent'] = $_POST['parent'];
}
$cat = get_category($id, ARRAY_A);
$data['category_description'] = $cat['category_description'];
$updated = wp_update_category($data);
if ($updated && !is_wp_error($updated)) {
echo _cat_row($updated, 0);
} else {
die(__('Category not updated.'));
}
break;
case 'link-cat':
$updated = wp_update_term($id, 'link_category', $_POST);
if ($updated && !is_wp_error($updated)) {
echo link_cat_row($updated['term_id']);
} else {
die(__('Category not updated.'));
}
break;
case 'tag':
$taxonomy = !empty($_POST['taxonomy']) ? $_POST['taxonomy'] : 'post_tag';
$tag = get_term($id, $taxonomy);
$_POST['description'] = $tag->description;
$updated = wp_update_term($id, $taxonomy, $_POST);
if ($updated && !is_wp_error($updated)) {
$tag = get_term($updated['term_id'], $taxonomy);
if (!$tag || is_wp_error($tag)) {
die(__('Tag not updated.'));
}
echo _tag_row($tag, '', $taxonomy);
示例4: wp_insert_term
) );
$x->send();
}
$r = wp_insert_term($_POST['name'], 'link_category', $_POST );
if ( is_wp_error( $r ) ) {
$x = new WP_AJAX_Response( array(
'what' => 'link-cat',
'id' => $r
) );
$x->send();
}
extract($r, EXTR_SKIP);
if ( !$link_cat = link_cat_row( $term_id ) )
die('0');
$x = new WP_Ajax_Response( array(
'what' => 'link-cat',
'id' => $term_id,
'data' => $link_cat
) );
$x->send();
break;
case 'add-tag' : // From Manage->Tags
check_ajax_referer( 'add-tag' );
if ( !current_user_can( 'manage_categories' ) )
die('-1');
if ( '' === trim($_POST['name']) ) {