PluginProbe ʕ •ᴥ•ʔ
WP Popular Posts / 7.3.6
WP Popular Posts v7.3.6
4.0.8 4.0.9 4.1.0 4.1.1 4.1.2 4.2.0 4.2.1 4.2.2 5.0.0 5.0.1 5.0.2 5.1.0 5.2.0 5.2.1 5.2.2 5.2.3 5.2.4 5.3.0 5.3.1 5.3.2 5.3.3 5.3.4 5.3.5 5.3.6 5.4.0 5.4.1 5.4.2 5.5.0 5.5.1 6.0.0 6.0.1 6.0.2 6.0.3 6.0.4 6.0.5 6.1.0 6.1.1 6.1.2 6.1.3 6.1.4 6.2.0 6.2.1 6.3.0 6.3.1 6.3.2 6.3.3 6.3.4 6.4.0 6.4.1 6.4.2 7.0.0 7.0.1 7.1.0 7.2.0 7.3.0 7.3.1 7.3.2 7.3.3 7.3.4 7.3.5 7.3.6 7.3.7 7.3.8 7.4.0 trunk 2.3.7 3.0.0 3.0.1 3.0.2 3.0.3 3.1.0 3.1.1 3.2.0 3.2.1 3.2.2 3.2.3 3.3.0 3.3.1 3.3.2 3.3.3 3.3.4 4.0.0 4.0.1 4.0.10 4.0.11 4.0.12 4.0.13 4.0.2 4.0.3 4.0.5 4.0.6
wordpress-popular-posts / src / Block / Widget / widget.js
wordpress-popular-posts / src / Block / Widget Last commit date
Widget.php 8 months ago edit.js 8 months ago editor.css 8 months ago widget.js 8 months ago
widget.js
222 lines
1 import icons from '../icons';
2 import { WPPWidgetBlockEdit } from './edit';
3
4 const { registerBlockType } = wp.blocks;
5 const { __ } = wp.i18n;
6
7 registerBlockType('wordpress-popular-posts/widget', {
8 title: 'WP Popular Posts',
9 category: 'widgets',
10 icon: icons.flame,
11 description: __('A highly customizable block that displays your most popular posts.', 'wordpress-popular-posts'),
12 keywords: ['popular', 'posts', 'trending', 'popularity'],
13
14 attributes: {
15 _editMode: {
16 type: 'boolean',
17 default: true
18 },
19 _isSelected: {
20 type: 'boolean',
21 default: false
22 },
23 title: {
24 type: 'string',
25 },
26 limit: {
27 type: 'number',
28 default: 10
29 },
30 offset: {
31 type: 'number',
32 default: 0
33 },
34 order_by: {
35 type: 'string',
36 default: 'views'
37 },
38 range: {
39 type: 'string',
40 default: 'last24hours'
41 },
42 time_quantity: {
43 type: 'number',
44 default: 24
45 },
46 time_unit: {
47 type: 'string',
48 default: 'hour'
49 },
50 freshness: {
51 type: 'boolean',
52 default: false
53 },
54 /* filters */
55 post_type: {
56 type: 'string',
57 default: 'post'
58 },
59 pid: /* Deprecated */ {
60 type: 'string',
61 default: ''
62 },
63 exclude: {
64 type: 'string',
65 default: ''
66 },
67 author: {
68 type: 'string',
69 default: ''
70 },
71 tax: {
72 type: 'string',
73 default: ''
74 },
75 term_id: {
76 type: 'string',
77 default: ''
78 },
79 /* post settings */
80 shorten_title: {
81 type: 'boolean',
82 default: false
83 },
84 title_length: {
85 type: 'number',
86 default: 0
87 },
88 title_by_words: {
89 type: 'number',
90 default: 0
91 },
92 display_post_excerpt: {
93 type: 'boolean',
94 default: false
95 },
96 excerpt_format: {
97 type: 'boolean',
98 default: false
99 },
100 excerpt_length: {
101 type: 'number',
102 default: 0
103 },
104 excerpt_by_words: {
105 type: 'number',
106 default: 0
107 },
108 display_post_thumbnail: {
109 type: 'boolean',
110 default: false
111 },
112 thumbnail_width: {
113 type: 'number',
114 default: 0
115 },
116 thumbnail_height: {
117 type: 'number',
118 default: 0
119 },
120 thumbnail_build: {
121 type: 'string',
122 default: 'manual'
123 },
124 thumbnail_size: {
125 type: 'string',
126 default: ''
127 },
128 rating: {
129 type: 'boolean',
130 default: false
131 },
132 /* stats tag settings */
133 stats_comments: {
134 type: 'boolean',
135 default: false
136 },
137 stats_views: {
138 type: 'boolean',
139 default: true
140 },
141 stats_author: {
142 type: 'boolean',
143 default: false
144 },
145 stats_date: {
146 type: 'boolean',
147 default: false
148 },
149 stats_date_format: {
150 type: 'string',
151 default: 'F j, Y'
152 },
153 stats_taxonomy: {
154 type: 'boolean',
155 default: false
156 },
157 taxonomy: {
158 type: 'string',
159 default: ''
160 },
161 /* HTML markup settings */
162 custom_html: {
163 type: 'boolean',
164 default: false
165 },
166 header_start: {
167 type: 'string',
168 default: '<h2>'
169 },
170 header_end: {
171 type: 'string',
172 default: '</h2>'
173 },
174 wpp_start: {
175 type: 'string',
176 default: '<ul class="wpp-list">'
177 },
178 wpp_end: {
179 type: 'string',
180 default: '</ul>'
181 },
182 post_html: {
183 type: 'string',
184 default: '<li class="{current_class}">{thumb} {title} <span class="wpp-meta post-stats">{stats}</span></li>'
185 },
186 theme: {
187 type: 'string',
188 default: ''
189 },
190 },
191 supports: {
192 anchor: true,
193 align: true,
194 html: false
195 },
196 example: {
197 attributes: {
198 _editMode: false,
199 title: 'Popular Posts',
200 limit: 3,
201 range: 'last7days',
202 display_post_excerpt: true,
203 excerpt_length: 75,
204 display_post_thumbnail: true,
205 thumbnail_width: 75,
206 thumbnail_height: 75,
207 stats_views: false,
208 stats_taxonomy: true,
209 custom_html: true,
210 wpp_start: '<ul class="wpp-list wpp-cards">',
211 post_html: '<li>{thumb_img} <div class="wpp-item-data"><div class="taxonomies">{taxonomy}</div>{title} <p class="wpp-excerpt">{excerpt}</p></div></li>',
212 theme: 'cards'
213 }
214 },
215
216 edit: WPPWidgetBlockEdit,
217
218 save: () => {
219 return null;
220 }
221 });
222