Changeset 23792
- Timestamp:
- 03/22/2013 10:42:37 PM (14 years ago)
- Location:
- trunk/wp-content/themes/twentyeleven
- Files:
-
- 2 edited
-
functions.php (modified) (2 diffs)
-
inc/widgets.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-content/themes/twentyeleven/functions.php
r23778 r23792 459 459 endif; // twentyeleven_content_nav 460 460 461 if ( ! function_exists( 'twentyeleven_url_grabber' ) ) : 461 /** 462 * Return the first link from the post content. If none found, the 463 * post permalink is used as a fallback. 464 * 465 * @return string 466 */ 467 function twentyeleven_get_first_url() { 468 $has_url = function_exists( 'get_the_url' ) ? get_the_url() : false; 469 470 if ( ! $has_url ) 471 $has_url = twentyeleven_url_grabber(); 472 473 return ( $has_url ) ? $has_url : apply_filters( 'the_permalink', get_permalink() ); 474 } 475 462 476 /** 463 477 * Return the URL for the first link found in the post content. … … 472 486 return esc_url_raw( $matches[1] ); 473 487 } 474 endif;475 488 476 489 /** -
trunk/wp-content/themes/twentyeleven/inc/widgets.php
r23191 r23792 96 96 97 97 <li class="widget-entry-title"> 98 <?php 99 // Grab first link from the post content. If none found, use the post permalink as fallback. 100 $link_url = twentyeleven_url_grabber(); 101 102 if ( empty( $link_url ) ) 103 $link_url = get_permalink(); 104 ?> 105 <a href="<?php echo esc_url( $link_url ); ?>" title="<?php echo esc_attr( sprintf( __( 'Link to %s', 'twentyeleven' ), the_title_attribute( 'echo=0' ) ) ); ?>" rel="bookmark"><?php the_title(); ?> <span>→</span></a> 98 <a href="<?php echo esc_url( twentyeleven_get_first_url() ); ?>" title="<?php echo esc_attr( sprintf( __( 'Link to %s', 'twentyeleven' ), the_title_attribute( 'echo=0' ) ) ); ?>" rel="bookmark"><?php the_title(); ?> <span>→</span></a> 106 99 <span class="comments-link"> 107 100 <?php comments_popup_link( __( '0 <span class="reply">comments →</span>', 'twentyeleven' ), __( '1 <span class="reply">comment →</span>', 'twentyeleven' ), __( '% <span class="reply">comments →</span>', 'twentyeleven' ) ); ?>
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)