Ticket #1079: 1079.diff
File 1079.diff, 1.8 KB (added by , 9 years ago) |
---|
-
classes/tagregator.php
114 114 add_action( 'init', array( $this, 'upgrade' ), 11 ); 115 115 add_action( 'wp_enqueue_scripts', __CLASS__ . '::load_resources' ); 116 116 add_action( 'admin_enqueue_scripts', __CLASS__ . '::load_resources' ); 117 add_filter ( 'wp_link_query_args', 'TGGRMediaSource::exclude_from_search_results' ); 118 117 119 } 118 120 119 121 /** -
classes/tggr-media-source.php
337 337 338 338 return $post_timestamp_local; 339 339 } 340 340 341 341 /** 342 342 * Retrieves the latest post mapped to a given hashtag 343 343 * @mvc Model 344 * 344 * 345 345 * @param $hashtag 346 * @return object|false 346 * @return object|false 347 347 */ 348 348 protected static function get_latest_hashtagged_post( $post_type, $hashtag ) { 349 349 $latest_post = false; … … 362 362 ), 363 363 ) 364 364 ) ); 365 365 366 366 if ( isset( $latest_post[0]->ID ) ) { 367 367 $latest_post = $latest_post[0]; 368 368 } 369 369 } 370 370 371 371 return $latest_post; 372 372 } 373 373 … … 461 461 462 462 return $length > self::POST_CONTENT_LENGTH_DISPLAY_LIMIT; 463 463 } 464 465 /** 466 * Filters CPTs from search results so it won't clutter up link insert list. 467 * 468 * @param WP_Query $query 469 * 470 * @return $query 471 */ 472 public static function exclude_from_search_results($query) { 473 $exclude_post_types = array ( 474 'tggr-tweets', 475 'tggr-instagram', 476 'tggr-flickr', 477 'tggr-google', 478 ); 479 $query = array_diff($query['post_type'], $exclude_post_types); 480 return $query; 481 } 464 482 } // end TGGRModule 465 483 } 484 No newline at end of file