Code cleanup from Mark Jaquith. fixes #1746
git-svn-id: https://develop.svn.wordpress.org/trunk@2943 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
4c18e778d0
commit
a8562a1455
@ -6,7 +6,8 @@ function get_the_author($idmode = '') {
|
||||
}
|
||||
|
||||
function the_author($idmode = '', $echo = true) {
|
||||
if ($echo) echo get_the_author($idmode);
|
||||
if ( $echo )
|
||||
echo get_the_author($idmode);
|
||||
return get_the_author($idmode);
|
||||
}
|
||||
|
||||
@ -19,35 +20,43 @@ function the_author_description() {
|
||||
}
|
||||
|
||||
function get_the_author_login() {
|
||||
global $id,$authordata; return $authordata->user_login;
|
||||
global $authordata;
|
||||
return $authordata->user_login;
|
||||
}
|
||||
|
||||
function the_author_login() {
|
||||
echo get_the_author_login();
|
||||
}
|
||||
|
||||
function get_the_author_firstname() {
|
||||
global $id,$authordata; return $authordata->first_name;
|
||||
global $authordata;
|
||||
return $authordata->first_name;
|
||||
}
|
||||
function the_author_firstname() {
|
||||
echo get_the_author_firstname();
|
||||
}
|
||||
|
||||
function get_the_author_lastname() {
|
||||
global $id,$authordata; return $authordata->last_name;
|
||||
global $authordata;
|
||||
return $authordata->last_name;
|
||||
}
|
||||
|
||||
function the_author_lastname() {
|
||||
echo get_the_author_lastname();
|
||||
}
|
||||
|
||||
function get_the_author_nickname() {
|
||||
global $id,$authordata; return $authordata->nickname;
|
||||
global $authordata;
|
||||
return $authordata->nickname;
|
||||
}
|
||||
|
||||
function the_author_nickname() {
|
||||
echo get_the_author_nickname();
|
||||
}
|
||||
|
||||
function get_the_author_ID() {
|
||||
global $id,$authordata; return $authordata->ID;
|
||||
global $authordata;
|
||||
return $authordata->ID;
|
||||
}
|
||||
function the_author_ID() {
|
||||
echo get_the_author_id();
|
||||
@ -63,57 +72,67 @@ function the_author_email() {
|
||||
}
|
||||
|
||||
function get_the_author_url() {
|
||||
global $id,$authordata; return $authordata->user_url;
|
||||
global $authordata;
|
||||
return $authordata->user_url;
|
||||
}
|
||||
|
||||
function the_author_url() {
|
||||
echo get_the_author_url();
|
||||
}
|
||||
|
||||
function get_the_author_icq() {
|
||||
global $id,$authordata; return $authordata->icq;
|
||||
global $authordata;
|
||||
return $authordata->icq;
|
||||
}
|
||||
|
||||
function the_author_icq() {
|
||||
echo get_the_author_icq();
|
||||
}
|
||||
|
||||
function get_the_author_aim() {
|
||||
global $id,$authordata; return str_replace(' ', '+', $authordata->aim);
|
||||
global $authordata;
|
||||
return str_replace(' ', '+', $authordata->aim);
|
||||
}
|
||||
|
||||
function the_author_aim() {
|
||||
echo get_the_author_aim();
|
||||
}
|
||||
|
||||
function get_the_author_yim() {
|
||||
global $id,$authordata; return $authordata->yim;
|
||||
global $authordata;
|
||||
return $authordata->yim;
|
||||
}
|
||||
|
||||
function the_author_yim() {
|
||||
echo get_the_author_yim();
|
||||
}
|
||||
|
||||
function get_the_author_msn() {
|
||||
global $id,$authordata; return $authordata->msn;
|
||||
global $authordata;
|
||||
return $authordata->msn;
|
||||
}
|
||||
|
||||
function the_author_msn() {
|
||||
echo get_the_author_msn();
|
||||
}
|
||||
|
||||
function get_the_author_posts() {
|
||||
global $id,$post;
|
||||
global $post;
|
||||
$posts = get_usernumposts($post->post_author);
|
||||
return $posts;
|
||||
}
|
||||
|
||||
function the_author_posts() {
|
||||
echo get_the_author_posts();
|
||||
}
|
||||
|
||||
/* the_author_posts_link() requires no get_, use get_author_link() */
|
||||
function the_author_posts_link($idmode='') {
|
||||
global $id, $authordata;
|
||||
global $authordata;
|
||||
|
||||
echo '<a href="' . get_author_link(0, $authordata->ID, $authordata->user_nicename) . '" title="' . sprintf(__("Posts by %s"), wp_specialchars(the_author($idmode, false))) . '">' . the_author($idmode, false) . '</a>';
|
||||
}
|
||||
|
||||
|
||||
function get_author_link($echo = false, $author_id, $author_nicename) {
|
||||
global $wpdb, $wp_rewrite, $post, $cache_userdata;
|
||||
$auth_ID = $author_id;
|
||||
@ -123,31 +142,40 @@ function get_author_link($echo = false, $author_id, $author_nicename) {
|
||||
$file = get_settings('home') . '/';
|
||||
$link = $file . '?author=' . $auth_ID;
|
||||
} else {
|
||||
if ('' == $author_nicename) $author_nicename = $cache_userdata[$author_id]->user_nicename;
|
||||
if ( '' == $author_nicename )
|
||||
$author_nicename = $cache_userdata[$author_id]->user_nicename;
|
||||
$link = str_replace('%author%', $author_nicename, $link);
|
||||
$link = get_settings('home') . trailingslashit($link);
|
||||
}
|
||||
|
||||
$link = apply_filters('author_link', $link, $author_id, $author_nicename);
|
||||
if ($echo) echo $link;
|
||||
|
||||
if ( $echo )
|
||||
echo $link;
|
||||
return $link;
|
||||
}
|
||||
|
||||
function wp_list_authors($args = '') {
|
||||
parse_str($args, $r);
|
||||
if (!isset($r['optioncount'])) $r['optioncount'] = false;
|
||||
if (!isset($r['exclude_admin'])) $r['exclude_admin'] = true;
|
||||
if (!isset($r['show_fullname'])) $r['show_fullname'] = false;
|
||||
if (!isset($r['hide_empty'])) $r['hide_empty'] = true;
|
||||
if (!isset($r['feed'])) $r['feed'] = '';
|
||||
if (!isset($r['feed_image'])) $r['feed_image'] = '';
|
||||
|
||||
if ( !isset($r['optioncount']) )
|
||||
$r['optioncount'] = false;
|
||||
if ( !isset($r['exclude_admin']) )
|
||||
$r['exclude_admin'] = true;
|
||||
if ( !isset($r['show_fullname']) )
|
||||
$r['show_fullname'] = false;
|
||||
if ( !isset($r['hide_empty']) )
|
||||
$r['hide_empty'] = true;
|
||||
if ( !isset($r['feed']) )
|
||||
$r['feed'] = '';
|
||||
if ( !isset($r['feed_image']) )
|
||||
$r['feed_image'] = '';
|
||||
|
||||
list_authors($r['optioncount'], $r['exclude_admin'], $r['show_fullname'], $r['hide_empty'], $r['feed'], $r['feed_image']);
|
||||
}
|
||||
|
||||
function list_authors($optioncount = false, $exclude_admin = true, $show_fullname = false, $hide_empty = true, $feed = '', $feed_image = '') {
|
||||
global $wpdb;
|
||||
|
||||
$query = "SELECT ID, user_nicename from $wpdb->users " . ($exclude_admin ? "WHERE user_login <> 'admin' " : '') . "ORDER BY display_name";
|
||||
$authors = $wpdb->get_results($query);
|
||||
|
||||
@ -156,11 +184,11 @@ function list_authors($optioncount = false, $exclude_admin = true, $show_fullnam
|
||||
$posts = get_usernumposts($author->ID);
|
||||
$name = $author->nickname;
|
||||
|
||||
if ($show_fullname && ($author->first_name != '' && $author->last_name != '')) {
|
||||
if ( $show_fullname && ($author->first_name != '' && $author->last_name != '') )
|
||||
$name = "$author->first_name $author->last_name";
|
||||
}
|
||||
|
||||
if (! ($posts == 0 && $hide_empty)) echo "<li>";
|
||||
if ( !($posts == 0 && $hide_empty) )
|
||||
echo "<li>";
|
||||
if ( $posts == 0 ) {
|
||||
if ( !$hide_empty )
|
||||
$link = $name;
|
||||
@ -168,13 +196,9 @@ function list_authors($optioncount = false, $exclude_admin = true, $show_fullnam
|
||||
$link = '<a href="' . get_author_link(0, $author->ID, $author->user_nicename) . '" title="' . sprintf(__("Posts by %s"), wp_specialchars($author->display_name)) . '">' . $name . '</a>';
|
||||
|
||||
if ( (! empty($feed_image)) || (! empty($feed)) ) {
|
||||
|
||||
$link .= ' ';
|
||||
|
||||
if (empty($feed_image)) {
|
||||
if (empty($feed_image))
|
||||
$link .= '(';
|
||||
}
|
||||
|
||||
$link .= '<a href="' . get_author_rss_link(0, $author->ID, $author->user_nicename) . '"';
|
||||
|
||||
if ( !empty($feed) ) {
|
||||
@ -186,25 +210,24 @@ function list_authors($optioncount = false, $exclude_admin = true, $show_fullnam
|
||||
|
||||
$link .= '>';
|
||||
|
||||
if (! empty($feed_image)) {
|
||||
if ( !empty($feed_image) )
|
||||
$link .= "<img src=\"$feed_image\" border=\"0\"$alt$title" . ' />';
|
||||
} else {
|
||||
else
|
||||
$link .= $name;
|
||||
}
|
||||
|
||||
$link .= '</a>';
|
||||
|
||||
if (empty($feed_image)) {
|
||||
if ( empty($feed_image) )
|
||||
$link .= ')';
|
||||
}
|
||||
}
|
||||
|
||||
if ($optioncount) {
|
||||
if ( $optioncount )
|
||||
$link .= ' ('. $posts . ')';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (! ($posts == 0 && $hide_empty)) echo "$link</li>";
|
||||
if ( !($posts == 0 && $hide_empty) )
|
||||
echo "$link</li>";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -41,9 +41,8 @@ function get_category_link($category_id) {
|
||||
|
||||
function get_the_category_list($separator = '', $parents='') {
|
||||
$categories = get_the_category();
|
||||
if (empty($categories)) {
|
||||
if (empty($categories))
|
||||
return apply_filters('the_category', __('Uncategorized'), $separator, $parents);
|
||||
}
|
||||
|
||||
$thelist = '';
|
||||
if ( '' == $separator ) {
|
||||
@ -53,16 +52,14 @@ function get_the_category_list($separator = '', $parents='') {
|
||||
$thelist .= "\n\t<li>";
|
||||
switch ( strtolower($parents) ) {
|
||||
case 'multiple':
|
||||
if ($category->category_parent) {
|
||||
if ($category->category_parent)
|
||||
$thelist .= get_category_parents($category->category_parent, TRUE);
|
||||
}
|
||||
$thelist .= '<a href="' . get_category_link($category->cat_ID) . '" title="' . sprintf(__("View all posts in %s"), $category->cat_name) . '" rel="category tag">'.$category->cat_name.'</a></li>';
|
||||
break;
|
||||
case 'single':
|
||||
$thelist .= '<a href="' . get_category_link($category->cat_ID) . '" title="' . sprintf(__("View all posts in %s"), $category->cat_name) . ' rel="category tag">';
|
||||
if ($category->category_parent) {
|
||||
if ($category->category_parent)
|
||||
$thelist .= get_category_parents($category->category_parent, FALSE);
|
||||
}
|
||||
$thelist .= $category->cat_name.'</a></li>';
|
||||
break;
|
||||
case '':
|
||||
@ -75,15 +72,18 @@ function get_the_category_list($separator = '', $parents='') {
|
||||
$i = 0;
|
||||
foreach ( $categories as $category ) {
|
||||
$category->cat_name = $category->cat_name;
|
||||
if (0 < $i) $thelist .= $separator . ' ';
|
||||
if ( 0 < $i )
|
||||
$thelist .= $separator . ' ';
|
||||
switch ( strtolower($parents) ) {
|
||||
case 'multiple':
|
||||
if ($category->category_parent) $thelist .= get_category_parents($category->category_parent, TRUE);
|
||||
if ( $category->category_parent )
|
||||
$thelist .= get_category_parents($category->category_parent, TRUE);
|
||||
$thelist .= '<a href="' . get_category_link($category->cat_ID) . '" title="' . sprintf(__("View all posts in %s"), $category->cat_name) . '" rel="category tag">'.$category->cat_name.'</a>';
|
||||
break;
|
||||
case 'single':
|
||||
$thelist .= '<a href="' . get_category_link($category->cat_ID) . '" title="' . sprintf(__("View all posts in %s"), $category->cat_name) . '" rel="category tag">';
|
||||
if ($category->category_parent) $thelist .= get_category_parents($category->category_parent, FALSE);
|
||||
if ( $category->category_parent )
|
||||
$thelist .= get_category_parents($category->category_parent, FALSE);
|
||||
$thelist .= "$category->cat_name</a>";
|
||||
break;
|
||||
case '':
|
||||
@ -109,17 +109,19 @@ function get_the_category_by_ID($cat_ID) {
|
||||
function get_category_parents($id, $link = FALSE, $separator = '/', $nicename = FALSE){
|
||||
$chain = '';
|
||||
$parent = &get_category($id);
|
||||
if ($nicename) {
|
||||
|
||||
if ( $nicename )
|
||||
$name = $parent->category_nicename;
|
||||
} else {
|
||||
else
|
||||
$name = $parent->cat_name;
|
||||
}
|
||||
if ($parent->category_parent) $chain .= get_category_parents($parent->category_parent, $link, $separator, $nicename);
|
||||
if ($link) {
|
||||
|
||||
if ( $parent->category_parent )
|
||||
$chain .= get_category_parents($parent->category_parent, $link, $separator, $nicename);
|
||||
|
||||
if ( $link )
|
||||
$chain .= '<a href="' . get_category_link($parent->cat_ID) . '" title="' . sprintf(__("View all posts in %s"), $parent->cat_name) . '">'.$name.'</a>' . $separator;
|
||||
} else {
|
||||
else
|
||||
$chain .= $name.$separator;
|
||||
}
|
||||
return $chain;
|
||||
}
|
||||
|
||||
@ -146,7 +148,8 @@ function the_category_ID($echo = true) {
|
||||
$categories = get_the_category();
|
||||
$cat = $categories[0]->cat_ID;
|
||||
|
||||
if ($echo) echo $cat;
|
||||
if ( $echo )
|
||||
echo $cat;
|
||||
|
||||
return $cat;
|
||||
}
|
||||
@ -167,7 +170,8 @@ function the_category_head($before='', $after='') {
|
||||
|
||||
function category_description($category = 0) {
|
||||
global $cat;
|
||||
if (!$category) $category = $cat;
|
||||
if ( !$category )
|
||||
$category = $cat;
|
||||
$category = & get_category($category);
|
||||
return apply_filters('category_description', $category->category_description, $category->cat_ID);
|
||||
}
|
||||
@ -177,8 +181,10 @@ function dropdown_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_
|
||||
$optiondates = 0, $optioncount = 0, $hide_empty = 1, $optionnone=FALSE,
|
||||
$selected=0, $hide=0) {
|
||||
global $wpdb;
|
||||
if (($file == 'blah') || ($file == '')) $file = get_settings('home') . '/';
|
||||
if (!$selected) $selected=$cat;
|
||||
if ( ($file == 'blah') || ($file == '') )
|
||||
$file = get_settings('home') . '/';
|
||||
if ( !$selected )
|
||||
$selected=$cat;
|
||||
$sort_column = 'cat_'.$sort_column;
|
||||
|
||||
$query = "
|
||||
@ -194,7 +200,8 @@ function dropdown_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_
|
||||
$query .= get_category_children($hide, " AND cat_ID != ");
|
||||
}
|
||||
$query .=" GROUP BY cat_ID";
|
||||
if (intval($hide_empty) == 1) $query .= " HAVING cat_count > 0";
|
||||
if ( intval($hide_empty) == 1 )
|
||||
$query .= " HAVING cat_count > 0";
|
||||
$query .= " ORDER BY $sort_column $sort_order, post_date DESC";
|
||||
|
||||
$categories = $wpdb->get_results($query);
|
||||
@ -203,7 +210,8 @@ function dropdown_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_
|
||||
$all = apply_filters('list_cats', $all);
|
||||
echo "\t<option value='0'>$all</option>\n";
|
||||
}
|
||||
if (intval($optionnone) == 1) echo "\t<option value='-1'>".__('None')."</option>\n";
|
||||
if ( intval($optionnone) == 1 )
|
||||
echo "\t<option value='-1'>".__('None')."</option>\n";
|
||||
if ( $categories ) {
|
||||
foreach ( $categories as $category ) {
|
||||
$cat_name = apply_filters('list_cats', $category->cat_name, $category);
|
||||
@ -212,8 +220,10 @@ function dropdown_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_
|
||||
echo ' selected="selected"';
|
||||
echo '>';
|
||||
echo $cat_name;
|
||||
if (intval($optioncount) == 1) echo ' ('.$category->cat_count.')';
|
||||
if (intval($optiondates) == 1) echo ' '.$category->lastday.'/'.$category->lastmonth;
|
||||
if ( intval($optioncount) == 1 )
|
||||
echo ' ('.$category->cat_count.')';
|
||||
if ( intval($optiondates) == 1 )
|
||||
echo ' '.$category->lastday.'/'.$category->lastmonth;
|
||||
echo "</option>\n";
|
||||
}
|
||||
}
|
||||
@ -223,24 +233,42 @@ function dropdown_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_
|
||||
// out of the WordPress loop
|
||||
function wp_list_cats($args = '') {
|
||||
parse_str($args, $r);
|
||||
if (!isset($r['optionall'])) $r['optionall'] = 0;
|
||||
if (!isset($r['all'])) $r['all'] = 'All';
|
||||
if (!isset($r['sort_column'])) $r['sort_column'] = 'ID';
|
||||
if (!isset($r['sort_order'])) $r['sort_order'] = 'asc';
|
||||
if (!isset($r['file'])) $r['file'] = '';
|
||||
if (!isset($r['list'])) $r['list'] = true;
|
||||
if (!isset($r['optiondates'])) $r['optiondates'] = 0;
|
||||
if (!isset($r['optioncount'])) $r['optioncount'] = 0;
|
||||
if (!isset($r['hide_empty'])) $r['hide_empty'] = 1;
|
||||
if (!isset($r['use_desc_for_title'])) $r['use_desc_for_title'] = 1;
|
||||
if (!isset($r['children'])) $r['children'] = true;
|
||||
if (!isset($r['child_of'])) $r['child_of'] = 0;
|
||||
if (!isset($r['categories'])) $r['categories'] = 0;
|
||||
if (!isset($r['recurse'])) $r['recurse'] = 0;
|
||||
if (!isset($r['feed'])) $r['feed'] = '';
|
||||
if (!isset($r['feed_image'])) $r['feed_image'] = '';
|
||||
if (!isset($r['exclude'])) $r['exclude'] = '';
|
||||
if (!isset($r['hierarchical'])) $r['hierarchical'] = true;
|
||||
if ( !isset($r['optionall']))
|
||||
$r['optionall'] = 0;
|
||||
if ( !isset($r['all']))
|
||||
$r['all'] = 'All';
|
||||
if ( !isset($r['sort_column']) )
|
||||
$r['sort_column'] = 'ID';
|
||||
if ( !isset($r['sort_order']) )
|
||||
$r['sort_order'] = 'asc';
|
||||
if ( !isset($r['file']) )
|
||||
$r['file'] = '';
|
||||
if ( !isset($r['list']) )
|
||||
$r['list'] = true;
|
||||
if ( !isset($r['optiondates']) )
|
||||
$r['optiondates'] = 0;
|
||||
if ( !isset($r['optioncount']) )
|
||||
$r['optioncount'] = 0;
|
||||
if ( !isset($r['hide_empty']) )
|
||||
$r['hide_empty'] = 1;
|
||||
if ( !isset($r['use_desc_for_title']) )
|
||||
$r['use_desc_for_title'] = 1;
|
||||
if ( !isset($r['children']) )
|
||||
$r['children'] = true;
|
||||
if ( !isset($r['child_of']) )
|
||||
$r['child_of'] = 0;
|
||||
if ( !isset($r['categories']) )
|
||||
$r['categories'] = 0;
|
||||
if ( !isset($r['recurse']) )
|
||||
$r['recurse'] = 0;
|
||||
if ( !isset($r['feed']) )
|
||||
$r['feed'] = '';
|
||||
if ( !isset($r['feed_image']) )
|
||||
$r['feed_image'] = '';
|
||||
if ( !isset($r['exclude']) )
|
||||
$r['exclude'] = '';
|
||||
if ( !isset($r['hierarchical']) )
|
||||
$r['hierarchical'] = true;
|
||||
|
||||
return list_cats($r['optionall'], $r['all'], $r['sort_column'], $r['sort_order'], $r['file'], $r['list'], $r['optiondates'], $r['optioncount'], $r['hide_empty'], $r['use_desc_for_title'], $r['children'], $r['child_of'], $r['categories'], $r['recurse'], $r['feed'], $r['feed_image'], $r['exclude'], $r['hierarchical']);
|
||||
}
|
||||
@ -248,9 +276,8 @@ function wp_list_cats($args = '') {
|
||||
function list_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_order = 'asc', $file = '', $list = true, $optiondates = 0, $optioncount = 0, $hide_empty = 1, $use_desc_for_title = 1, $children=FALSE, $child_of=0, $categories=0, $recurse=0, $feed = '', $feed_image = '', $exclude = '', $hierarchical=FALSE) {
|
||||
global $wpdb, $category_posts;
|
||||
// Optiondates now works
|
||||
if ('' == $file) {
|
||||
if ( '' == $file )
|
||||
$file = get_settings('home') . '/';
|
||||
}
|
||||
|
||||
$exclusions = '';
|
||||
if ( !empty($exclude) ) {
|
||||
@ -287,12 +314,11 @@ function list_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_orde
|
||||
GROUP BY category_id");
|
||||
if ( !empty($cat_counts) ) {
|
||||
foreach ( $cat_counts as $cat_count ) {
|
||||
if (1 != intval($hide_empty) || $cat_count > 0) {
|
||||
if ( 1 != intval($hide_empty) || $cat_count > 0 )
|
||||
$category_posts["$cat_count->cat_ID"] = $cat_count->cat_count;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( $optiondates ) {
|
||||
$cat_dates = $wpdb->get_results(" SELECT category_id,
|
||||
@ -312,11 +338,10 @@ function list_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_orde
|
||||
if ( (intval($hide_empty) == 0 || isset($category_posts["$category->cat_ID"])) && (!$hierarchical || $category->category_parent == $child_of) ) {
|
||||
$num_found++;
|
||||
$link = '<a href="'.get_category_link($category->cat_ID).'" ';
|
||||
if ($use_desc_for_title == 0 || empty($category->category_description)) {
|
||||
if ( $use_desc_for_title == 0 || empty($category->category_description) )
|
||||
$link .= 'title="'. sprintf(__("View all posts filed under %s"), wp_specialchars($category->cat_name)) . '"';
|
||||
} else {
|
||||
else
|
||||
$link .= 'title="' . wp_specialchars(apply_filters('category_description',$category->category_description,$category)) . '"';
|
||||
}
|
||||
$link .= '>';
|
||||
$link .= apply_filters('list_cats', $category->cat_name, $category).'</a>';
|
||||
|
||||
@ -324,9 +349,8 @@ function list_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_orde
|
||||
|
||||
$link .= ' ';
|
||||
|
||||
if (empty($feed_image)) {
|
||||
if ( empty($feed_image) )
|
||||
$link .= '(';
|
||||
}
|
||||
|
||||
$link .= '<a href="' . get_category_rss_link(0, $category->cat_ID, $category->category_nicename) . '"';
|
||||
|
||||
@ -339,33 +363,35 @@ function list_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_orde
|
||||
|
||||
$link .= '>';
|
||||
|
||||
if (! empty($feed_image)) {
|
||||
if ( !empty($feed_image) )
|
||||
$link .= "<img src='$feed_image' $alt$title" . ' />';
|
||||
} else {
|
||||
else
|
||||
$link .= $name;
|
||||
}
|
||||
|
||||
$link .= '</a>';
|
||||
|
||||
if (empty($feed_image)) {
|
||||
if (empty($feed_image))
|
||||
$link .= ')';
|
||||
}
|
||||
}
|
||||
|
||||
if (intval($optioncount) == 1) {
|
||||
if ( intval($optioncount) == 1 )
|
||||
$link .= ' ('.intval($category_posts["$category->cat_ID"]).')';
|
||||
}
|
||||
|
||||
if ( $optiondates ) {
|
||||
if ( $optiondates == 1 ) $optiondates = 'Y-m-d';
|
||||
if ( $optiondates == 1 )
|
||||
$optiondates = 'Y-m-d';
|
||||
$link .= ' ' . gmdate($optiondates, $category_timestamp["$category->cat_ID"]);
|
||||
}
|
||||
if ($list) {
|
||||
|
||||
if ( $list )
|
||||
$thelist .= "\t<li>$link\n";
|
||||
} else {
|
||||
else
|
||||
$thelist .= "\t$link<br />\n";
|
||||
}
|
||||
if ($hierarchical && $children) $thelist .= list_cats($optionall, $all, $sort_column, $sort_order, $file, $list, $optiondates, $optioncount, $hide_empty, $use_desc_for_title, $hierarchical, $category->cat_ID, $categories, 1, $feed, $feed_image, $exclude, $hierarchical);
|
||||
if ($list) $thelist .= "</li>\n";
|
||||
|
||||
if ($hierarchical && $children)
|
||||
$thelist .= list_cats($optionall, $all, $sort_column, $sort_order, $file, $list, $optiondates, $optioncount, $hide_empty, $use_desc_for_title, $hierarchical, $category->cat_ID, $categories, 1, $feed, $feed_image, $exclude, $hierarchical);
|
||||
if ($list)
|
||||
$thelist .= "</li>\n";
|
||||
}
|
||||
}
|
||||
if ( !$num_found && !$child_of ) {
|
||||
@ -383,18 +409,17 @@ function list_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_orde
|
||||
$pre = $post = '';
|
||||
}
|
||||
$thelist = $pre . $thelist . $post;
|
||||
if ($recurse) {
|
||||
if ( $recurse )
|
||||
return $thelist;
|
||||
}
|
||||
echo apply_filters('list_cats', $thelist);
|
||||
}
|
||||
|
||||
function in_category($category) { // Check if the current post is in the given category
|
||||
global $post, $category_cache;
|
||||
$cats = '';
|
||||
foreach ($category_cache[$post->ID] as $cat) :
|
||||
foreach ( $category_cache[$post->ID] as $cat ) {
|
||||
$cats[] = $cat->cat_ID;
|
||||
endforeach;
|
||||
}
|
||||
|
||||
if ( in_array($category, $cats) )
|
||||
return true;
|
||||
|
Loading…
Reference in New Issue
Block a user