-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathorbit-bundle.php
More file actions
132 lines (110 loc) · 3.62 KB
/
orbit-bundle.php
File metadata and controls
132 lines (110 loc) · 3.62 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
<?php
/*
Plugin Name: Orbit Bundle
Plugin URI: http://sputznik.com
Description: Create Wordpress Custom post types and custom taxonomies. Search and filter through the wordpress post types and create custom queries using simple shortcodes.
Author: Samuel Thomas
Version: 2.3.0
Author URI: http://sputznik.com
*/
define( 'ORBIT_BUNDLE_VERSION', '2.3.0' );
$inc_files = array(
"lib/class-orbit-base.php",
"lib/class-orbit-shortcode.php",
"lib/class-orbit-batch-process.php",
"lib/class-orbit-csv.php",
"lib/class-orbit-bulk-delete.php",
"lib/class-orbit-translations.php",
"lib/class-orbit-util.php",
"lib/class-orbit-wp.php",
"lib/class-orbit-multipart-form.php",
"lib/class-orbit-form-field.php",
"lib/class-orbit-assets.php",
"orbit-search/orbit-search.php",
"orbit-query/orbit-query.php",
"orbit-templates/orbit-templates.php",
"orbit-cache/orbit-cache.php",
"admin/class-orbit-admin.php",
"orbit-fep/class-orbit-fep.php",
"so-widgets/so-widgets.php"
);
foreach( $inc_files as $inc_file ){
require_once( $inc_file );
}
/*
// GUTENBERG BLOCK
add_action( 'init', function(){
wp_register_script(
'orbit-query-block',
plugins_url( 'dist/js/orbit-query-block.js', __FILE__ ),
array( 'wp-blocks', 'wp-element' ),
filemtime( plugin_dir_path( __FILE__ ) . 'dist/js/orbit-query-block.js' )
);
wp_register_style(
'orbit-blocks',
plugins_url( 'dist/css/orbit-query.css', __FILE__ ),
array( 'wp-edit-blocks' ),
filemtime( plugin_dir_path( __FILE__ ) . 'dist/css/orbit-query.css' )
);
// LOCALIZE ORBIT SETTINGS
$orbit_settings = array( 'post_types' => array(), 'styles' => array(), 'taxonomies' => array() );
// POST TYPES
$post_types = get_post_types( array( 'public' => true ), 'objects' );
foreach( $post_types as $post_type ){
array_push( $orbit_settings['post_types'], array( 'label' => $post_type->label, 'value' => $post_type->name ) );
}
// ORBIT TEMPLATES
global $orbit_templates;
$templates = $orbit_templates->get_templates_list();
foreach( $templates as $template ){
array_push( $orbit_settings['styles'], array( 'label' => $template->post_title, 'value' => $template->ID ) );
}
// TAXONOMIES
$taxonomies = get_taxonomies( array( 'public' => true ), 'objects' );
array_push( $orbit_settings['taxonomies'], array( 'label' => 'Select None', 'value' => '' ) );
foreach( $taxonomies as $taxonomy ){
array_push( $orbit_settings['taxonomies'], array( 'label' => $taxonomy->label, 'value' => $taxonomy->name ) );
}
$orbit_settings['orbit_query_atts'] = array(
'post_type' => array(
'type' => 'string',
),
'posts_per_page' => array(
'type' => 'number',
),
'style_id' => array(
'type' => 'number',
),
'style' => array(
'type' => 'string',
'default' => 'db'
),
'taxonomy' => array(
'type' => 'string',
),
'term' => array(
'type' => 'string',
),
'tax_query' => array(
'type' => 'string',
//'default' => 'category:uncategorized'
),
);
wp_localize_script( 'orbit-query-block', 'orbit_settings', $orbit_settings );
// END OF LOCALIZE ORBIT SETTINGS
if( function_exists('register_block_type') ){
global $orbit_query;
register_block_type( 'orbit-bundle/orbit-query', array(
'editor_script' => 'orbit-query-block',
'editor_style' => 'orbit-blocks',
'attributes' => $orbit_settings['orbit_query_atts'],
'render_callback' => array( $orbit_query, 'plain_shortcode' )
) );
}
} );
// ENQUEUE ASSETS
add_action( 'wp_enqueue_scripts', function(){
wp_enqueue_style( 'orbit-blocks' );
} );
*/
do_action('orbit-bundle-loaded');