A backend interface for tagging.
git-svn-id: http://svn.automattic.com/wordpress/trunk@5110 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -647,7 +647,7 @@ function checked( $checked, $current) {
|
||||
|
||||
function return_categories_list( $parent = 0 ) {
|
||||
global $wpdb;
|
||||
return $wpdb->get_col( "SELECT cat_ID FROM $wpdb->categories WHERE category_parent = $parent AND ( link_count = 0 OR category_count != 0 OR ( link_count = 0 AND category_count = 0 ) ) ORDER BY category_count DESC" );
|
||||
return $wpdb->get_col( "SELECT cat_ID FROM $wpdb->categories WHERE category_parent = $parent AND ( ( link_count = 0 AND tag_count = 0 ) OR category_count != 0 OR ( link_count = 0 AND category_count = 0 AND tag_count = 0 ) ) ORDER BY category_count DESC" );
|
||||
}
|
||||
|
||||
function sort_cats( $cat1, $cat2 ) {
|
||||
@@ -657,6 +657,29 @@ function sort_cats( $cat1, $cat2 ) {
|
||||
return strcasecmp( $cat1['cat_name'], $cat2['cat_name'] );
|
||||
}
|
||||
|
||||
function get_tags_to_edit( $post_id ) {
|
||||
global $wpdb;
|
||||
|
||||
$post_id = (int) $post_id;
|
||||
if ( !$post_id )
|
||||
return false;
|
||||
|
||||
$tags = $wpdb->get_results( "
|
||||
SELECT category_id, cat_name
|
||||
FROM $wpdb->categories, $wpdb->post2cat
|
||||
WHERE $wpdb->post2cat.category_id = cat_ID AND $wpdb->post2cat.post_id = '$post_id' AND rel_type = 'tag'
|
||||
" );
|
||||
if ( !$tags )
|
||||
return false;
|
||||
|
||||
foreach ( $tags as $tag )
|
||||
$tag_names[] = $tag->cat_name;
|
||||
$tags_to_edit = join( ', ', $tag_names );
|
||||
$tags_to_edit = attribute_escape( $tags_to_edit );
|
||||
$tags_to_edit = apply_filters( 'tags_to_edit', $tags_to_edit );
|
||||
return $tags_to_edit;
|
||||
}
|
||||
|
||||
function get_nested_categories( $default = 0, $parent = 0 ) {
|
||||
global $post_ID, $link_id, $mode, $wpdb;
|
||||
|
||||
@@ -664,7 +687,7 @@ function get_nested_categories( $default = 0, $parent = 0 ) {
|
||||
$checked_categories = $wpdb->get_col( "
|
||||
SELECT category_id
|
||||
FROM $wpdb->categories, $wpdb->post2cat
|
||||
WHERE $wpdb->post2cat.category_id = cat_ID AND $wpdb->post2cat.post_id = '$post_ID'
|
||||
WHERE $wpdb->post2cat.category_id = cat_ID AND $wpdb->post2cat.post_id = '$post_ID' AND rel_type = 'category'
|
||||
" );
|
||||
|
||||
if ( count( $checked_categories ) == 0 ) {
|
||||
@@ -721,7 +744,7 @@ function dropdown_categories( $default = 0 ) {
|
||||
|
||||
function return_link_categories_list( $parent = 0 ) {
|
||||
global $wpdb;
|
||||
return $wpdb->get_col( "SELECT cat_ID FROM $wpdb->categories WHERE category_parent = $parent AND ( category_count = 0 OR link_count != 0 OR ( link_count = 0 AND category_count = 0 ) ) ORDER BY link_count DESC" );
|
||||
return $wpdb->get_col( "SELECT cat_ID FROM $wpdb->categories WHERE category_parent = $parent AND ( ( category_count = 0 AND tag_count = 0 ) OR link_count != 0 OR ( link_count = 0 AND category_count = 0 AND tag_count = 0 ) ) ORDER BY link_count DESC" );
|
||||
}
|
||||
|
||||
function get_nested_link_categories( $default = 0, $parent = 0 ) {
|
||||
|
||||
Reference in New Issue
Block a user