Changeset 23787
- Timestamp:
- 03/22/2013 06:57:50 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-content/themes/twentythirteen/functions.php
r23786 r23787 422 422 if ( ! function_exists( 'twentythirteen_get_first_url' ) ) : 423 423 /** 424 * Return the URL for the first link in the post content or the permalink if no 425 * URL is found. 424 * Returns the URL from the post. 425 * 426 * @uses get_the_link() to get the URL in the post meta (if it exists) or 427 * the first link found in the post content. 428 * 429 * Falls back to the post permalink if no URL is found in the post. 426 430 * 427 431 * @since Twenty Thirteen 1.0 … … 429 433 */ 430 434 function twentythirteen_get_first_url() { 431 $has_url = preg_match( '/<a\s[^>]*?href=[\'"](.+?)[\'"]/is', get_the_content(), $match ); 432 $link = ( $has_url ) ? $match[1] : apply_filters( 'the_permalink', get_permalink() ); 433 434 return esc_url_raw( $link ); 435 $has_url = get_the_url(); 436 437 return ( $has_url ) ? $has_url : apply_filters( 'the_permalink', get_permalink() ); 435 438 } 436 439 endif;
Note: See TracChangeset
for help on using the changeset viewer.