diff --git a/wp-content/themes/twentyeleven/functions.php b/wp-content/themes/twentyeleven/functions.php index 1d8385dd47..aed278bab2 100644 --- a/wp-content/themes/twentyeleven/functions.php +++ b/wp-content/themes/twentyeleven/functions.php @@ -458,7 +458,21 @@ function twentyeleven_content_nav( $html_id ) { } endif; // twentyeleven_content_nav -if ( ! function_exists( 'twentyeleven_url_grabber' ) ) : +/** + * Return the first link from the post content. If none found, the + * post permalink is used as a fallback. + * + * @return string + */ +function twentyeleven_get_first_url() { + $has_url = function_exists( 'get_the_url' ) ? get_the_url() : false; + + if ( ! $has_url ) + $has_url = twentyeleven_url_grabber(); + + return ( $has_url ) ? $has_url : apply_filters( 'the_permalink', get_permalink() ); +} + /** * Return the URL for the first link found in the post content. * @@ -471,7 +485,6 @@ function twentyeleven_url_grabber() { return esc_url_raw( $matches[1] ); } -endif; /** * Count the number of footer sidebars to enable dynamic classes for the footer diff --git a/wp-content/themes/twentyeleven/inc/widgets.php b/wp-content/themes/twentyeleven/inc/widgets.php index c4c8ae0014..859cde1a82 100644 --- a/wp-content/themes/twentyeleven/inc/widgets.php +++ b/wp-content/themes/twentyeleven/inc/widgets.php @@ -95,14 +95,7 @@ class Twenty_Eleven_Ephemera_Widget extends WP_Widget {