PluginProbe
Essential Widgets / 2.2
Essential Widgets v2.2
3.2.1 3.3 3.2 trunk 1.0.0 1.0.1 1.1 1.2 1.2.1 1.2.2 1.3 1.4 1.4.1 1.5 1.6 1.7 1.7.1 1.7.2 1.7.3 1.7.4 1.8 1.9 2.0 2.1 2.2 All 31 releases
essential-widgets / includes / ew-block / blocks / ew-category / index.php

index.php in Essential Widgets 2.2, at includes/ew-block/blocks/ew-category/index.php

129 lines 3.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 // Hook the post rendering to the block
4 if ( function_exists( 'register_block_type' ) ) :
5 register_block_type(
6 'ew-block/ew-category',
7 array(
8 'attributes' => array(
9 'title' => array(
10 'type' => 'string',
11 'default' => esc_html__( 'Categories', 'essential-widgets' ),
12 ),
13 'taxonomy' => array(
14 'type' => 'string',
15 'default' => 'category',
16 ),
17 'style' => array(
18 'type' => 'string',
19 'default' => '',
20 ),
21 'include' => array(
22 'type' => 'string',
23 'default' => '',
24 ),
25 'exclude' => array(
26 'type' => 'string',
27 'default' => '',
28 ),
29 'exclude_tree' => array(
30 'type' => 'string',
31 'default' => '',
32 ),
33 'child_of' => array(
34 'type' => 'string',
35 'default' => '',
36 ),
37 'current_category' => array(
38 'type' => 'string',
39 'default' => '',
40 ),
41 'search' => array(
42 'type' => 'string',
43 'default' => '',
44 ),
45 'hierarchical' => array(
46 'type' => 'boolean',
47 'default' => true,
48 ),
49 'hide_empty' => array(
50 'type' => 'boolean',
51 'default' => true,
52 ),
53 'order' => array(
54 'type' => 'string',
55 'default' => 'ASC',
56 ),
57 'orderby' => array(
58 'type' => 'string',
59 'default' => 'name',
60 ),
61 'depth' => array(
62 'type' => 'number',
63 'default' => 0,
64 ),
65 'number' => array(
66 'type' => 'number',
67 'default' => 10,
68 ),
69 'feed' => array(
70 'type' => 'string',
71 'default' => '',
72 ),
73 'feed_type' => array(
74 'type' => 'string',
75 'default' => '',
76 ),
77 'feed_image' => array(
78 'type' => 'string',
79 'default' => '',
80 ),
81 'use_desc_for_title' => array(
82 'type' => 'boolean',
83 'default' => false,
84 ),
85 'show_count' => array(
86 'type' => 'boolean',
87 'default' => false,
88 ),
89 'is_block' => array(
90 'type' => 'boolean',
91 'default' => true,
92 ),
93 ),
94 'render_callback' => 'ew_category_render_shortcode',
95 )
96 );
97 endif;
98
99 if ( ! function_exists( 'ew_category_render_shortcode' ) ) :
100 add_shortcode( 'ew-category', 'ew_category_render_shortcode' );
101 function ew_category_render_shortcode( $atts ) {
102 $instance['title'] = $atts['title'];
103 $instance['taxonomy'] = $atts['taxonomy'];
104 $instance['style'] = $atts['style'];
105 $instance['include'] = $atts['include'];
106 $instance['exclude'] = $atts['exclude'];
107 $instance['exclude_tree'] = $atts['exclude_tree'];
108 $instance['child_of'] = $atts['child_of'];
109 $instance['current_category'] = $atts['current_category'];
110 $instance['search'] = $atts['search'];
111 $instance['hierarchical'] = $atts['hierarchical'];
112 $instance['hide_empty'] = $atts['hide_empty'];
113 $instance['order'] = $atts['order'];
114 $instance['orderby'] = $atts['orderby'];
115 $instance['depth'] = $atts['depth'];
116 $instance['number'] = $atts['number'];
117 $instance['feed'] = $atts['feed'];
118 $instance['feed_type'] = $atts['feed_type'];
119 $instance['feed_image'] = $atts['feed_image'];
120 $instance['use_desc_for_title'] = $atts['use_desc_for_title'];
121 $instance['show_count'] = $atts['show_count'];
122 $instance['is_block'] = $atts['is_block'];
123
124 $ew_category = new EW_Categories();
125
126 return $ew_category->shortcode( $instance );
127 }
128 endif;
129