Changeset 9853
- Timestamp:
- 05/12/2020 07:17:45 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/support-forums/inc/class-directory-compat.php
r9663 r9853 36 36 37 37 // Add plugin or theme name to view feed titles. 38 add_ action( 'bbp_feed', array( $this, 'add_compat_title_to_feed' ) );38 add_filter( 'wp_title_rss', array( $this, 'title_correction_for_feed' ) ); 39 39 40 40 // Define the taxonomy and query vars for this view. … … 146 146 147 147 /** 148 * Add plugin or theme name to view feed titles.149 *150 * bbPress uses 'All Topics' title for view feeds, which isn't useful when151 * dealing with plugin or theme support.152 *153 * @see https://meta.trac.wordpress.org/ticket/2078154 * @see https://bbpress.trac.wordpress.org/ticket/3064155 */156 public function add_compat_title_to_feed() {157 if ( empty( $this->query['bbp_view'] ) || empty( $this->query[ $this->query_var() ] ) ) {158 return;159 }160 161 add_filter( 'gettext', array( $this, 'title_correction_for_feed' ), 10, 3 );162 }163 164 /**165 148 * Replace 'All Topics' feed title with an appropriate view title 166 149 * that includes the plugin or theme name. 167 150 * 168 151 * @see https://meta.trac.wordpress.org/ticket/2078 169 * @see https://bbpress.trac.wordpress.org/ticket/3064 170 * 171 * @param string $translation Translated text. 172 * @param string $text Text to translate. 173 * @param string $domain Text domain. 174 * @return string New feed title. 175 */ 176 public function title_correction_for_feed( $translation, $text, $domain ) { 177 if ( 'bbpress' !== $domain || 'All Topics' !== $text ) { 178 return $translation; 179 } 180 181 remove_filter( 'gettext', array( $this, 'title_correction_for_feed' ), 10, 3 ); 152 */ 153 public function title_correction_for_feed( $title ) { 154 if ( empty( $this->query['bbp_view'] ) || empty( $this->query[ $this->query_var() ] ) ) { 155 return $title; 156 } 182 157 183 158 $object = $this->get_object( $this->query[ $this->query_var() ] ); 184 159 if ( ! $object ) { 185 return $t ranslation;160 return $title; 186 161 } 187 162 … … 190 165 switch ( $this->query['bbp_view'] ) { 191 166 case $this->compat(): 192 $t ranslation =$this->compat_title();167 $title = get_bloginfo_rss( 'name' ) . ' » ' . $this->compat_title(); 193 168 break; 194 169 case 'reviews': 195 $t ranslation =$this->reviews_title();170 $title = get_bloginfo_rss( 'name' ) . ' » ' . $this->reviews_title(); 196 171 break; 197 172 case 'active': 198 $t ranslation =$this->active_title();173 $title = get_bloginfo_rss( 'name' ) . ' » ' . $this->active_title(); 199 174 break; 200 175 case 'unresolved': 201 $t ranslation =$this->unresolved_title();176 $title = get_bloginfo_rss( 'name' ) . ' » ' . $this->unresolved_title(); 202 177 break; 203 178 } 204 179 205 return $t ranslation;180 return $title; 206 181 } 207 182
Note: See TracChangeset
for help on using the changeset viewer.