Changeset 8643
- Timestamp:
- 08/13/2008 11:26:14 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/post-template.php
r8642 r8643 170 170 * @since 2.7 171 171 * 172 * @ param string$class One or more classes to add to the class list172 * @param string|array $class One or more classes to add to the class list 173 173 * @param int $post_id An optional post ID 174 174 */ 175 175 function post_class( $class = '', $post_id = null ) { 176 // Separates classes with a single space, collates classes for post DIV 177 echo 'class="' . join( ' ', get_post_class( $class, $post_id ) ) . '"'; 178 } 179 180 /** 181 * Returns the classes for the post div as an array 182 * 183 * {@internal Missing Long Description}} 184 * 185 * @package WordPress 186 * @subpackage Post 187 * @since 2.7 188 * 189 * @param string|array $class One or more classes to add to the class list 190 * @param int $post_id An optional post ID 191 * @return array Array of classes 192 */ 193 function get_post_class( $class = '', $post_id = null ) { 176 194 $post = get_post($post_id); 177 195 … … 202 220 203 221 if ( !empty($class) ) { 204 $class = preg_split('#\s+#', $class); 222 if ( !is_array( $class ) ) 223 $class = preg_split('#\s+#', $class); 205 224 $classes = array_merge($classes, $class); 206 225 } 207 226 208 // Separates classes with a single space, collates classes for post DIV 209 $classes = join(' ', apply_filters('post_class', $classes, $class, $post_id)); 210 211 echo 'class="' . $classes . '"'; 227 return apply_filters('post_class', $classes, $class, $post_id); 212 228 } 213 229
Note: See TracChangeset
for help on using the changeset viewer.