WP hooks navigation: Home/browse • Actions index • Filters index
To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).
The best way to understand what a hook does is to look at where it occurs in the source code.
do_action( "hook_name" )apply_filters( "hook_name", "what_to_filter" ).Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.
This hook occurs 4 times in this file.
| Line | Code |
|---|---|
| 194 | $query .= get_category_children($hide, " AND cat_ID != "); |
| 195 | } |
| 196 | $query .=" GROUP BY cat_ID"; |
| 197 | if (intval($hide_empty) == 1) $query .= " HAVING cat_count > 0"; |
| 198 | $query .= " ORDER BY $sort_column $sort_order, post_date DESC"; |
| 199 | |
| 200 | $categories = $wpdb->get_results($query); |
| 201 | echo "<select name='cat' class='postform'>\n"; |
| 202 | if (intval($optionall) == 1) { |
| 203 | $all = apply_filters('list_cats', $all); |
| 204 | echo "\t<option value='0'>$all</option>\n"; |
| 205 | } |
| 206 | if (intval($optionnone) == 1) echo "\t<option value='-1'>".__('None')."</option>\n"; |
| 207 | if ($categories) { |
| 208 | foreach ($categories as $category) { |
| 209 | $cat_name = apply_filters('list_cats', $category->cat_name, $category); |
| 210 | echo "\t<option value=\"".$category->cat_ID."\""; |
| 211 | if ($category->cat_ID == $selected) |
| 212 | echo ' selected="selected"'; |
| 213 | echo '>'; |
| 214 | echo $cat_name; |
| 215 | if (intval($optioncount) == 1) echo ' ('.$category->cat_count.')'; |
| 216 | if (intval($optiondates) == 1) echo ' '.$category->lastday.'/'.$category->lastmonth; |
| 217 | echo "</option>\n"; |
| 218 | } |
| Line | Code |
| 312 | if ((intval($hide_empty) == 0 || isset($category_posts["$category->cat_ID"])) && (!$hierarchical || $category->category_parent == $child_of) ) { |
| 313 | $num_found++; |
| 314 | $link = '<a href="'.get_category_link($category->cat_ID).'" '; |
| 315 | if ($use_desc_for_title == 0 || empty($category->category_description)) { |
| 316 | $link .= 'title="'. sprintf(__("View all posts filed under %s"), wp_specialchars($category->cat_name)) . '"'; |
| 317 | } else { |
| 318 | $link .= 'title="' . wp_specialchars(apply_filters('category_description',$category->category_description,$category)) . '"'; |
| 319 | } |
| 320 | $link .= '>'; |
| 321 | $link .= apply_filters('list_cats', $category->cat_name, $category).'</a>'; |
| 322 | |
| 323 | if ( (! empty($feed_image)) || (! empty($feed)) ) { |
| 324 | |
| 325 | $link .= ' '; |
| 326 | |
| 327 | if (empty($feed_image)) { |
| 328 | $link .= '('; |
| 329 | } |
| 330 | |
| Line | Code |
| 380 | $pre = "\t\t<ul class='children'>"; |
| 381 | $post = "\t\t</ul>\n"; |
| 382 | } else { |
| 383 | $pre = $post = ''; |
| 384 | } |
| 385 | $thelist = $pre . $thelist . $post; |
| 386 | if ($recurse) { |
| 387 | return $thelist; |
| 388 | } |
| 389 | echo apply_filters('list_cats', $thelist); |
| 390 | } |
| 391 | |
| 392 | function in_category($category) { // Check if the current post is in the given category |
| 393 | global $post, $category_cache; |
| 394 | $cats = ''; |
| 395 | foreach ($category_cache[$post->ID] as $cat) : |
| 396 | $cats[] = $cat->cat_ID; |
| 397 | endforeach; |
| 398 | |