Browse code

汎用クラス追加

nita authored on 2015/10/07 03:26:15
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,29 @@
0
+<?php
1
+/**
2
+ * Description of class-rucy-componet
3
+ *
4
+ * @author Nita
5
+ */
6
+class Class_Rucy_Component {
7
+    /**
8
+     * 
9
+     * 
10
+     * @return bool 
11
+     */
12
+    public function update_support_post_type( array $post_types ) {
13
+        return update_option( RC_SETTING_OPTION_KEY, $post_types );
14
+    }
15
+    public function get_support_post_type() {
16
+        $res = get_option( RC_SETTING_OPTION_KEY );
17
+        if( !is_array( $res ) ) {
18
+            $res = array( 'post', 'page' );
19
+        }
20
+        return $res;
21
+    }
22
+    public function get_post_types( $type = 'objects' ) {
23
+        $args = array( 'public' => true, );
24
+        $post_types = get_post_types( $args, $type );
25
+        unset( $post_types['attachment'], $post_types['revision'], $post_types['nav_menu_item'] );
26
+        return $post_types;
27
+    }
28
+}