WordPress.org

Plugin Directory

Changeset 729553


Ignore:
Timestamp:
06/21/13 19:24:59 (10 months ago)
Author:
georgestephanis
Message:

Jetpack: Omnisearch: Change Omnisearch_Posts to let it be initialized for Custom Post Types without needing to extend the class. Remove the static $instance.

Location:
jetpack/trunk/modules/omnisearch
Files:
1 deleted
2 edited

Legend:

Unmodified
Added
Removed
  • jetpack/trunk/modules/omnisearch/omnisearch-core.php

    r728971 r729553  
    55require_once( dirname(__FILE__) . '/omnisearch-posts.php' ); 
    66new Jetpack_Omnisearch_Posts; 
    7  
    8 require_once( dirname(__FILE__) . '/omnisearch-pages.php' ); 
    9 new Jetpack_Omnisearch_Pages; 
     7new Jetpack_Omnisearch_Posts( 'page' ); 
    108 
    119require_once( dirname(__FILE__) . '/omnisearch-comments.php' ); 
  • jetpack/trunk/modules/omnisearch/omnisearch-posts.php

    r728539 r729553  
    55 
    66class Jetpack_Omnisearch_Posts extends WP_List_Table { 
    7     static $instance; 
    8     var $post_type = 'post'; 
     7    var $post_type = 'post', 
     8        $post_type_object; 
    99 
    10     function __construct() { 
    11         self::$instance = $this; 
     10    function __construct( $post_type = 'post' ) { 
     11        $this->post_type = $post_type; 
    1212        add_filter( 'omnisearch_results', array( $this, 'search'), 10, 2 ); 
    1313    } 
    1414 
    1515    function search( $results, $search_term ) { 
     16        if( ! post_type_exists( $this->post_type ) ) 
     17            return $results; 
     18 
    1619        parent::__construct(); 
    1720 
Note: See TracChangeset for help on using the changeset viewer.