wp/wp-includes/post-formats.php
changeset 18 be944660c56a
parent 16 a86126ab1dd4
child 21 48c4eec2b7e6
equal deleted inserted replaced
17:34716fd837a4 18:be944660c56a
     9 /**
     9 /**
    10  * Retrieve the format slug for a post
    10  * Retrieve the format slug for a post
    11  *
    11  *
    12  * @since 3.1.0
    12  * @since 3.1.0
    13  *
    13  *
    14  * @param int|object|null $post Optional. Post ID or post object. Defaults to the current post in the loop.
    14  * @param int|WP_Post|null $post Optional. Post ID or post object. Defaults to the current post in the loop.
    15  * @return string|false The format if successful. False otherwise.
    15  * @return string|false The format if successful. False otherwise.
    16  */
    16  */
    17 function get_post_format( $post = null ) {
    17 function get_post_format( $post = null ) {
    18 	$post = get_post( $post );
    18 	$post = get_post( $post );
    19 
    19 
    39 /**
    39 /**
    40  * Check if a post has any of the given formats, or any format.
    40  * Check if a post has any of the given formats, or any format.
    41  *
    41  *
    42  * @since 3.1.0
    42  * @since 3.1.0
    43  *
    43  *
    44  * @param string|array     $format Optional. The format or formats to check.
    44  * @param string|string[]  $format Optional. The format or formats to check.
    45  * @param WP_Post|int|null $post   Optional. The post to check. Defaults to the current post in the loop.
    45  * @param WP_Post|int|null $post   Optional. The post to check. Defaults to the current post in the loop.
    46  * @return bool True if the post has any of the given formats (or any format, if no format specified),
    46  * @return bool True if the post has any of the given formats (or any format, if no format specified),
    47  *              false otherwise.
    47  *              false otherwise.
    48  */
    48  */
    49 function has_post_format( $format = array(), $post = null ) {
    49 function has_post_format( $format = array(), $post = null ) {
   184  * @access private
   184  * @access private
   185  * @since 3.1.0
   185  * @since 3.1.0
   186  *
   186  *
   187  * @global WP_Rewrite $wp_rewrite WordPress rewrite component.
   187  * @global WP_Rewrite $wp_rewrite WordPress rewrite component.
   188  *
   188  *
   189  * @param string $link
   189  * @param string  $link
   190  * @param object $term
   190  * @param WP_Term $term
   191  * @param string $taxonomy
   191  * @param string  $taxonomy
   192  * @return string
   192  * @return string
   193  */
   193  */
   194 function _post_format_link( $link, $term, $taxonomy ) {
   194 function _post_format_link( $link, $term, $taxonomy ) {
   195 	global $wp_rewrite;
   195 	global $wp_rewrite;
   196 	if ( 'post_format' !== $taxonomy ) {
   196 	if ( 'post_format' !== $taxonomy ) {