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 3 times in this file.
| Line | Code |
|---|---|
| 149 | * @param string $separator Optional, default is empty string. Separator for between the categories. |
| 150 | * @param string $parents Optional. How to display the parents. |
| 151 | * @param int $post_id Optional. Post ID to retrieve categories. |
| 152 | * @return string |
| 153 | */ |
| 154 | function get_the_category_list( $separator = '', $parents='', $post_id = false ) { |
| 155 | global $wp_rewrite; |
| 156 | $categories = get_the_category( $post_id ); |
| 157 | if ( !is_object_in_taxonomy( get_post_type( $post_id ), 'category' ) ) |
| 158 | return apply_filters( 'the_category', '', $separator, $parents ); |
| 159 | |
| 160 | if ( empty( $categories ) ) |
| 161 | return apply_filters( 'the_category', __( 'Uncategorized' ), $separator, $parents ); |
| 162 | |
| 163 | $rel = ( is_object( $wp_rewrite ) && $wp_rewrite->using_permalinks() ) ? 'rel="category tag"' : 'rel="category"'; |
| 164 | |
| 165 | $thelist = ''; |
| 166 | if ( '' == $separator ) { |
| 167 | $thelist .= '<ul class="post-categories">'; |
| 168 | foreach ( $categories as $category ) { |
| 169 | $thelist .= "\n\t<li>"; |
| 170 | switch ( strtolower( $parents ) ) { |
| Line | Code |
| 203 | $thelist .= "$category->name</a>"; |
| 204 | break; |
| 205 | case '': |
| 206 | default: |
| 207 | $thelist .= '<a href="' . get_category_link( $category->term_id ) . '" title="' . esc_attr( sprintf( __( "View all posts in %s" ), $category->name ) ) . '" ' . $rel . '>' . $category->name.'</a>'; |
| 208 | } |
| 209 | ++$i; |
| 210 | } |
| 211 | } |
| 212 | return apply_filters( 'the_category', $thelist, $separator, $parents ); |
| 213 | } |
| 214 | |
| 215 | |
| 216 | /** |
| 217 | * Check if the current post in within any of the given categories. |
| 218 | * |
| 219 | * The given categories are checked against the post's categories' term_ids, names and slugs. |
| 220 | * Categories given as integers will only be checked against the post's categories' term_ids. |
| 221 | * |