PluginProbe ʕ •ᴥ•ʔ
WP Popular Posts / 7.0.1
WP Popular Posts v7.0.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 1 year ago edit.js 1 year ago editor.css 1 year ago widget.js 1 year ago
widget.js
218 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 rating: {
125 type: 'boolean',
126 default: false
127 },
128 /* stats tag settings */
129 stats_comments: {
130 type: 'boolean',
131 default: false
132 },
133 stats_views: {
134 type: 'boolean',
135 default: true
136 },
137 stats_author: {
138 type: 'boolean',
139 default: false
140 },
141 stats_date: {
142 type: 'boolean',
143 default: false
144 },
145 stats_date_format: {
146 type: 'string',
147 default: 'F j, Y'
148 },
149 stats_taxonomy: {
150 type: 'boolean',
151 default: false
152 },
153 taxonomy: {
154 type: 'string',
155 default: ''
156 },
157 /* HTML markup settings */
158 custom_html: {
159 type: 'boolean',
160 default: false
161 },
162 header_start: {
163 type: 'string',
164 default: '<h2>'
165 },
166 header_end: {
167 type: 'string',
168 default: '</h2>'
169 },
170 wpp_start: {
171 type: 'string',
172 default: '<ul class="wpp-list">'
173 },
174 wpp_end: {
175 type: 'string',
176 default: '</ul>'
177 },
178 post_html: {
179 type: 'string',
180 default: '<li>{thumb} {title} <span class="wpp-meta post-stats">{stats}</span></li>'
181 },
182 theme: {
183 type: 'string',
184 default: ''
185 },
186 },
187 supports: {
188 anchor: true,
189 align: true,
190 html: false
191 },
192 example: {
193 attributes: {
194 _editMode: false,
195 title: 'Popular Posts',
196 limit: 3,
197 range: 'last7days',
198 display_post_excerpt: true,
199 excerpt_length: 75,
200 display_post_thumbnail: true,
201 thumbnail_width: 75,
202 thumbnail_height: 75,
203 stats_views: false,
204 stats_taxonomy: true,
205 custom_html: true,
206 wpp_start: '<ul class="wpp-list wpp-cards">',
207 post_html: '<li>{thumb_img} <div class="wpp-item-data"><div class="taxonomies">{taxonomy}</div>{title} <p class="wpp-excerpt">{excerpt}</p></div></li>',
208 theme: 'cards'
209 }
210 },
211
212 edit: WPPWidgetBlockEdit,
213
214 save: () => {
215 return null;
216 }
217 });
218