forked from misterbisson/scriblio
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscriblio.php
More file actions
48 lines (41 loc) · 1.68 KB
/
scriblio.php
File metadata and controls
48 lines (41 loc) · 1.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
/*
Plugin Name: Scriblio Search
Plugin URI: http://about.scriblio.net/
Version: 3 beta 2
Author: Casey Bisson
Author URI: http://maisonbisson.com/blog/
*/
// include required components
require_once( dirname( __FILE__ ) .'/plugin/class-facets.php');
require_once( dirname( __FILE__ ) .'/plugin/class-facet-searchword.php');
require_once( dirname( __FILE__ ) .'/plugin/class-facet-taxonomy.php');
require_once( dirname( __FILE__ ) .'/plugin/class-facet-post-author.php');
require_once( dirname( __FILE__ ) .'/plugin/class-facet-post-type.php');
require_once( dirname( __FILE__ ) .'/plugin/widgets.php');
require_once( dirname( __FILE__ ) .'/plugin/class-scrib-suggest.php');
// register default facets
function scrib_register_default_facets()
{
// register keyword search facet
scrib_register_facet( 'searchword' , 'Facet_Searchword' , array( 'priority' => 0 , 'has_rewrite' => TRUE ) );
// register public taxonomies as facets
foreach( (array) get_taxonomies( array( 'public' => true )) as $taxonomy )
{
$taxonomy = get_taxonomy( $taxonomy );
scrib_register_facet(
( empty( $taxonomy->label ) ? $taxonomy->name : sanitize_title_with_dashes( $taxonomy->label )),
'Facet_Taxonomy' ,
array(
'taxonomy' => $taxonomy->name ,
'query_var' => $taxonomy->query_var ,
'has_rewrite' => is_array( $taxonomy->rewrite ),
'priority' => 5,
)
);
}
// register facets from the posts table
scrib_register_facet( 'post_author' , 'Facet_Post_Author' , array( 'priority' => 3 , 'has_rewrite' => TRUE ));
scrib_register_facet( 'post_type' , 'Facet_Post_Type' , array( 'priority' => 3 , 'has_rewrite' => TRUE ) );
}
add_action( 'scrib_register_facets' , 'scrib_register_default_facets' );