PluginProbe ʕ •ᴥ•ʔ
WP Popular Posts / 5.4.1
WP Popular Posts v5.4.1
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 4 years ago edit.js 4 years ago editor.css 4 years ago widget.js 4 years ago
widget.js
214 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: 'WordPress 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: {
60 type: 'string',
61 default: ''
62 },
63 author: {
64 type: 'string',
65 default: ''
66 },
67 tax: {
68 type: 'string',
69 default: ''
70 },
71 term_id: {
72 type: 'string',
73 default: ''
74 },
75 /* post settings */
76 shorten_title: {
77 type: 'boolean',
78 default: false
79 },
80 title_length: {
81 type: 'number',
82 default: 0
83 },
84 title_by_words: {
85 type: 'number',
86 default: 0
87 },
88 display_post_excerpt: {
89 type: 'boolean',
90 default: false
91 },
92 excerpt_format: {
93 type: 'boolean',
94 default: false
95 },
96 excerpt_length: {
97 type: 'number',
98 default: 0
99 },
100 excerpt_by_words: {
101 type: 'number',
102 default: 0
103 },
104 display_post_thumbnail: {
105 type: 'boolean',
106 default: false
107 },
108 thumbnail_width: {
109 type: 'number',
110 default: 0
111 },
112 thumbnail_height: {
113 type: 'number',
114 default: 0
115 },
116 thumbnail_build: {
117 type: 'string',
118 default: 'manual'
119 },
120 thumbnail_size: {
121 type: 'string',
122 default: ''
123 },
124 /* stats tag settings */
125 stats_comments: {
126 type: 'boolean',
127 default: false
128 },
129 stats_views: {
130 type: 'boolean',
131 default: true
132 },
133 stats_author: {
134 type: 'boolean',
135 default: false
136 },
137 stats_date: {
138 type: 'boolean',
139 default: false
140 },
141 stats_date_format: {
142 type: 'string',
143 default: 'F j, Y'
144 },
145 stats_taxonomy: {
146 type: 'boolean',
147 default: false
148 },
149 taxonomy: {
150 type: 'string',
151 default: ''
152 },
153 /* HTML markup settings */
154 custom_html: {
155 type: 'boolean',
156 default: false
157 },
158 header_start: {
159 type: 'string',
160 default: '<h2>'
161 },
162 header_end: {
163 type: 'string',
164 default: '</h2>'
165 },
166 wpp_start: {
167 type: 'string',
168 default: '<ul class="wpp-list">'
169 },
170 wpp_end: {
171 type: 'string',
172 default: '</ul>'
173 },
174 post_html: {
175 type: 'string',
176 default: '<li>{thumb} {title} <span class="wpp-meta post-stats">{stats}</span></li>'
177 },
178 theme: {
179 type: 'string',
180 default: ''
181 },
182 },
183 supports: {
184 anchor: true,
185 align: true,
186 html: false
187 },
188 example: {
189 attributes: {
190 _editMode: false,
191 title: 'Popular Posts',
192 limit: 3,
193 range: 'last7days',
194 display_post_excerpt: true,
195 excerpt_length: 75,
196 display_post_thumbnail: true,
197 thumbnail_width: 75,
198 thumbnail_height: 75,
199 stats_views: false,
200 stats_taxonomy: true,
201 custom_html: true,
202 wpp_start: '<ul class="wpp-list wpp-cards">',
203 post_html: '<li>{thumb_img} <div class="wpp-item-data"><div class="taxonomies">{taxonomy}</div>{title} <p class="wpp-excerpt">{excerpt}</p></div></li>',
204 theme: 'cards'
205 }
206 },
207
208 edit: WPPWidgetBlockEdit,
209
210 save: () => {
211 return null;
212 }
213 });
214