Revert most of [16332] - renaming and deprecating a commonly used function is silly. Improving it is good. Fixes #15407.
git-svn-id: https://develop.svn.wordpress.org/trunk@16334 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
e559ab58a3
commit
b08df21c26
@ -596,7 +596,7 @@ class WP_Posts_List_Table extends WP_List_Table {
|
|||||||
case 'categories':
|
case 'categories':
|
||||||
?>
|
?>
|
||||||
<td <?php echo $attributes ?>><?php
|
<td <?php echo $attributes ?>><?php
|
||||||
$categories = get_the_categories();
|
$categories = get_the_category();
|
||||||
if ( !empty( $categories ) ) {
|
if ( !empty( $categories ) ) {
|
||||||
$out = array();
|
$out = array();
|
||||||
foreach ( $categories as $c ) {
|
foreach ( $categories as $c ) {
|
||||||
|
@ -141,7 +141,7 @@
|
|||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
<div class="entry-utility">
|
<div class="entry-utility">
|
||||||
<?php if ( count( get_the_categories() ) ) : ?>
|
<?php if ( count( get_the_category() ) ) : ?>
|
||||||
<span class="cat-links">
|
<span class="cat-links">
|
||||||
<?php printf( __( '<span class="%1$s">Posted in</span> %2$s', 'twentyten' ), 'entry-utility-prep entry-utility-prep-cat-links', get_the_category_list( ', ' ) ); ?>
|
<?php printf( __( '<span class="%1$s">Posted in</span> %2$s', 'twentyten' ), 'entry-utility-prep entry-utility-prep-cat-links', get_the_category_list( ', ' ) ); ?>
|
||||||
</span>
|
</span>
|
||||||
|
@ -57,18 +57,19 @@ function get_category_parents( $id, $link = false, $separator = '/', $nicename =
|
|||||||
/**
|
/**
|
||||||
* Retrieve post categories.
|
* Retrieve post categories.
|
||||||
*
|
*
|
||||||
* @since 3.1
|
* @since 0.71
|
||||||
|
* @uses $post
|
||||||
*
|
*
|
||||||
* @param int $id Optional, default to current post ID. The post ID.
|
* @param int $id Optional, default to current post ID. The post ID.
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
function get_the_categories( $id = false ) {
|
function get_the_category( $id = false ) {
|
||||||
$categories = get_the_terms( $id, 'category' );
|
$categories = get_the_terms( $id, 'category' );
|
||||||
|
|
||||||
foreach ( (array) array_keys( $categories ) as $key ) {
|
foreach ( (array) array_keys( $categories ) as $key ) {
|
||||||
_make_cat_compat( $categories[$key] );
|
_make_cat_compat( $categories[$key] );
|
||||||
}
|
}
|
||||||
|
// Filter name is plural because we are return alot of categories not just one
|
||||||
return apply_filters( 'get_the_categories', $categories );
|
return apply_filters( 'get_the_categories', $categories );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -139,7 +140,7 @@ function get_the_category_by_ID( $cat_ID ) {
|
|||||||
*/
|
*/
|
||||||
function get_the_category_list( $separator = '', $parents='', $post_id = false ) {
|
function get_the_category_list( $separator = '', $parents='', $post_id = false ) {
|
||||||
global $wp_rewrite;
|
global $wp_rewrite;
|
||||||
$categories = get_the_categories( $post_id );
|
$categories = get_the_category( $post_id );
|
||||||
if ( !is_object_in_taxonomy( get_post_type( $post_id ), 'category' ) )
|
if ( !is_object_in_taxonomy( get_post_type( $post_id ), 'category' ) )
|
||||||
return apply_filters( 'the_category', '', $separator, $parents );
|
return apply_filters( 'the_category', '', $separator, $parents );
|
||||||
|
|
||||||
|
@ -72,17 +72,17 @@ function start_wp() {
|
|||||||
*
|
*
|
||||||
* @since 0.71
|
* @since 0.71
|
||||||
* @deprecated 0.71
|
* @deprecated 0.71
|
||||||
* @deprecated use get_the_categories()
|
* @deprecated use get_the_category()
|
||||||
* @see get_the_categories()
|
* @see get_the_category()
|
||||||
*
|
*
|
||||||
* @param bool $echo
|
* @param bool $echo
|
||||||
* @return null|int
|
* @return null|int
|
||||||
*/
|
*/
|
||||||
function the_category_ID($echo = true) {
|
function the_category_ID($echo = true) {
|
||||||
_deprecated_function( __FUNCTION__, '0.71', 'get_the_categories()' );
|
_deprecated_function( __FUNCTION__, '0.71', 'get_the_category()' );
|
||||||
|
|
||||||
// Grab the first cat in the list.
|
// Grab the first cat in the list.
|
||||||
$categories = get_the_categories();
|
$categories = get_the_category();
|
||||||
$cat = $categories[0]->term_id;
|
$cat = $categories[0]->term_id;
|
||||||
|
|
||||||
if ( $echo )
|
if ( $echo )
|
||||||
@ -108,7 +108,7 @@ function the_category_head($before='', $after='') {
|
|||||||
_deprecated_function( __FUNCTION__, '0.71', 'get_the_category_by_ID()' );
|
_deprecated_function( __FUNCTION__, '0.71', 'get_the_category_by_ID()' );
|
||||||
|
|
||||||
// Grab the first cat in the list.
|
// Grab the first cat in the list.
|
||||||
$categories = get_the_categories();
|
$categories = get_the_category();
|
||||||
$currentcat = $categories[0]->category_id;
|
$currentcat = $categories[0]->category_id;
|
||||||
if ( $currentcat != $previouscat ) {
|
if ( $currentcat != $previouscat ) {
|
||||||
echo $before;
|
echo $before;
|
||||||
@ -2556,19 +2556,3 @@ function is_plugin_page() {
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Retrieve post categories.
|
|
||||||
*
|
|
||||||
* @since 0.71
|
|
||||||
* @uses $post
|
|
||||||
* @deprecated 3.1
|
|
||||||
* @deprecated Use get_post_categories() instead.
|
|
||||||
*
|
|
||||||
* @param int $id Optional, default to current post ID. The post ID.
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
function get_the_category( $id = false ) {
|
|
||||||
_deprecated_function( __FUNCTION__, '3.1', 'get_the_categories()' );
|
|
||||||
return get_the_categories( $id );
|
|
||||||
}
|
|
||||||
|
@ -299,7 +299,7 @@ function comment_text_rss() {
|
|||||||
function get_the_category_rss($type = null) {
|
function get_the_category_rss($type = null) {
|
||||||
if ( empty($type) )
|
if ( empty($type) )
|
||||||
$type = get_default_feed();
|
$type = get_default_feed();
|
||||||
$categories = get_the_categories();
|
$categories = get_the_category();
|
||||||
$tags = get_the_tags();
|
$tags = get_the_tags();
|
||||||
$the_list = '';
|
$the_list = '';
|
||||||
$cat_names = array();
|
$cat_names = array();
|
||||||
|
@ -119,7 +119,7 @@ function get_permalink($id = 0, $leavename = false) {
|
|||||||
|
|
||||||
$category = '';
|
$category = '';
|
||||||
if ( strpos($permalink, '%category%') !== false ) {
|
if ( strpos($permalink, '%category%') !== false ) {
|
||||||
$cats = get_the_categories($post->ID);
|
$cats = get_the_category($post->ID);
|
||||||
if ( $cats ) {
|
if ( $cats ) {
|
||||||
usort($cats, '_usort_terms_by_ID'); // order by ID
|
usort($cats, '_usort_terms_by_ID'); // order by ID
|
||||||
$category = $cats[0]->slug;
|
$category = $cats[0]->slug;
|
||||||
|
@ -349,7 +349,7 @@ function get_post_class( $class = '', $post_id = null ) {
|
|||||||
|
|
||||||
// Categories
|
// Categories
|
||||||
if ( is_object_in_taxonomy( $post->post_type, 'category' ) ) {
|
if ( is_object_in_taxonomy( $post->post_type, 'category' ) ) {
|
||||||
foreach ( (array) get_the_categories($post->ID) as $cat ) {
|
foreach ( (array) get_the_category($post->ID) as $cat ) {
|
||||||
if ( empty($cat->slug ) )
|
if ( empty($cat->slug ) )
|
||||||
continue;
|
continue;
|
||||||
$classes[] = 'category-' . sanitize_html_class($cat->slug, $cat->term_id);
|
$classes[] = 'category-' . sanitize_html_class($cat->slug, $cat->term_id);
|
||||||
|
Loading…
Reference in New Issue
Block a user