Changeset 3468 for sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-plugin-directory.php
- Timestamp:
- 06/19/2016 12:15:28 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-plugin-directory.php
r3465 r3468 235 235 add_filter( 'the_content', array( $this, 'translate_post_content' ), 1, 2 ); 236 236 add_filter( 'the_title', array( $this, 'translate_post_title' ), 1, 2 ); 237 add_filter( 'get_the_excerpt', array( $this, 'translate_post_excerpt' ), 1 );237 add_filter( 'get_the_excerpt', array( $this, 'translate_post_excerpt' ), 1, 2 ); 238 238 } 239 239 … … 508 508 * @return string 509 509 */ 510 public function translate_post_title( $title, $post_id ) {510 public function translate_post_title( $title, $post_id = null ) { 511 511 $post = get_post(); 512 512 513 513 if ( $post instanceof \WP_Post && $post_id === $post->ID ) { 514 $title = Plugin_I18n::instance()->translate( 'title', $title );514 $title = Plugin_I18n::instance()->translate( 'title', $title, [ 'post_id' => $post ] ); 515 515 } 516 516 … … 522 522 * 523 523 * @param string $excerpt 524 * @param \WP_Post $post 524 525 * @return string 525 526 */ 526 public function translate_post_excerpt( $excerpt ) {527 return Plugin_I18n::instance()->translate( 'excerpt', $excerpt );527 public function translate_post_excerpt( $excerpt, $post ) { 528 return Plugin_I18n::instance()->translate( 'excerpt', $excerpt, [ 'post_id' => $post ] ); 528 529 } 529 530
Note: See TracChangeset
for help on using the changeset viewer.