Essential Content Types - Version 1.8.2

Version Description

(Released: Aug 19, 2020) == * Bug Fixed: Issue in add new theme page

Download this release

Release Info

Developer catchthemes
Plugin Icon Essential Content Types
Version 1.8.2
Comparing to
See all releases

Code changes from version 1.8.1 to 1.8.2

README.txt CHANGED
@@ -1,279 +1,282 @@
1
- === Essential Content Types ===
2
- Contributors: catchplugins, catchthemes, sakinshrestha, pratikshrestha, maheshmaharjan, dreamsapana
3
- Donate link: https://catchplugins.com/plugins/essential-content-types-pro/
4
- Tags: custom post types, CPT, CMS, post, types, post type, taxonomy, tax, custom, content types, post types, custom content types, testimonial, portfolio, featured content, service
5
- Requires at least: 4.8
6
- Tested up to: 5.4
7
- Stable tag: trunk
8
- License: GPLv3 or later
9
- License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
-
11
- Essential Content Types allows you to feature the impressive content through different content/post types on your website just the way you want it. These content/post types are missed by the themes in WordPress Theme Directory as the feature falls more towards the plugins’ territory.
12
-
13
- == Description ==
14
-
15
- **Essential Content Types** allows you to feature the impressive content through different content/post types on your website just the way you want it. These content/post types are missed by the themes in WordPress Theme Directory as the feature falls more towards the plugins' territory.
16
-
17
- Content is at the forefront of any website. Changing the layout of your important content changes the way your website looks, which may not be a plus point if your current website layout is loved by your users.
18
-
19
- Additionally, switching themes changes your website layout completely. Therefore, to keep things looking spic-and- span in your website, we bring you Essential Content.
20
-
21
- Essential Content allows you to add up to three content/post types:
22
- * Portfolio – Create and display your portfolio on your website
23
- * Testimonials – Add customer testimonials to your website
24
- * Featured Content – Display the content you want as featured content on your website to attract visitors' attention
25
- * Services – Add your services on your website
26
-
27
- Features of Essential Content:
28
- * Enable/Disable any content/post type as needed
29
- * Light-weight
30
- * Supports all themes on WordPress
31
-
32
- Essential Content is inspired by *Jetpack's Custom Content Types feature*.
33
-
34
- However, not everyone wants to have a plugin that “does-it- all”. Some may want plugins to be niche focused and concentrate on smaller areas.
35
-
36
- That is precisely what we have done with Essential Content. Essential content, true to its name, has only the essential elements. We have added the features that WordPressers use most. We have ruled out all other elements to make it non-bloated and clean. It takes up lesser space and does the job well.
37
-
38
- If you think we have missed any essential content/post types, please let us know. We’ll review the frequency of usage and add your suggestions.
39
-
40
- ***Portfolio Shortcode***
41
-
42
- You can use shortcodes to embed portfolio projects on posts and pages.
43
-
44
- **Embedding Portfolio Projects**
45
-
46
- To embed portfolio projects on posts and pages, first activate the Portfolio custom content type on your site and add some projects to your portfolio.
47
-
48
- Next, add the `[portfolio]` shortcode to a post or page. The shortcode will display projects in different ways, depending on how you use the optional attributes to customize the portfolio layout.
49
-
50
- **Attributes**
51
- * display_types: display Project Types. (true/false)
52
- * display_tags: display Project Tags. (true/false)
53
- * display_content: display project content. (true/false)
54
- * include_type: display specific Project Types. Defaults to all. (comma-separated list of Project Type slugs)
55
- * include_tag: display specific Project Tags. Defaults to all. (comma-separated list of Project Tag slugs)
56
- * columns: number of columns in shortcode. Defaults to 2. (number, 1-6)
57
- * showposts: number of projects to display. Defaults to all. (number)
58
- * order: display projects in ascending or descending order. Defaults to ASC for sorting in ascending order, but you can reverse the order by using DESC to display projects in descending order instead. (ASC/DESC)
59
- * orderby: sort projects by different criteria, including author name, project title, and even rand to display in a random order. Defaults to sorting by date. (author, date, title, rand)
60
-
61
- **Example**
62
- `
63
- [portfolio display_types="true" display_tags="false" include_type="grooming-tips,best-kitties" columns="2" showposts="10" orderby="title"]
64
- `
65
- The example will display up to ten portfolio projects in two columns, in ascending alphabetical order by project title. It will display Project Types, hide Project Tags, and only display projects that are assigned the “Grooming Tips” or “Best Kitties” Project Types.
66
-
67
-
68
- ***Featured Content Shortcode***
69
-
70
- You can use shortcodes to embed featured content on posts and pages.
71
-
72
- **Embedding Featured Content Projects**
73
-
74
- To embed featured content on posts and pages, first activate the Featured Content content type on your site and add some projects to your featured content.
75
-
76
- Next, add the `[featured_content]` shortcode to a post or page. The shortcode will display projects in different ways, depending on how you use the optional attributes to customize the featured content layout.
77
-
78
- **Attributes**
79
- * display_types: display Content Types. (true/false)
80
- * display_tags: display Content Tags. (true/false)
81
- * display_content: display project content. (true/false)
82
- * include_type: display specific Content Types. Defaults to all. (comma-separated list of Content Type slugs)
83
- * include_tag: display specific Content Tags. Defaults to all. (comma-separated list of Content Tag slugs)
84
- * columns: number of columns in shortcode. Defaults to 2. (number, 1-6)
85
- * showposts: number of projects to display. Defaults to all. (number)
86
- * order: display projects in ascending or descending order. Defaults to ASC for sorting in ascending order, but you can reverse the order by using DESC to display projects in descending order instead. (ASC/DESC)
87
- * orderby: sort projects by different criteria, including author name, project title, and even rand to display in a random order. Defaults to sorting by date. (author, date, title, rand)
88
-
89
- **Example**
90
- `
91
- [featured_content display_types="true" display_tags="false" include_type="grooming-tips,best-kitties" columns="2" showposts="10" orderby="title"]
92
- `
93
- The example will display up to ten featured content in two columns, in ascending alphabetical order by project title. It will display Content Types, hide Content Tags, and only display projects that are assigned the “Grooming Tips” or “Best Kitties” Content Types.
94
-
95
- ***Testimonials Shortcode***
96
-
97
- You can use shortcodes to embed testimonials on posts and pages.
98
- Embedding Testimonials
99
-
100
- To embed testimonials on posts and pages, first activate the Testimonial custom content type on your site and add some testimonials.
101
-
102
- Next, add the `[testimonials]` shortcode to a post or page. The shortcode will display testimonials in different ways, depending on how you use the optional attributes to customize the testimonials layout.
103
-
104
- **Attributes**
105
- * display_content: display testimonial content. (full/true/false)
106
- * image: display the featured image. (true/false) Defaults to true.
107
- * columns: number of columns in shortcode. Defaults to 1. (number, 1-6)
108
- * showposts: number of testimonials to display. Defaults to all. (number)
109
- * order: display testimonials in ascending or descending chronological order. Defaults to ASC for sorting in ascending order, but you can reverse the order by using DESC to display testimonials in descending order instead. (ASC/DESC)
110
- * orderby: sort testimonials by different criteria, including author name, testimonial title, and even rand to display in a random order. Defaults to sorting by date. (author, date, title, rand)
111
-
112
- **Example**
113
- `
114
- [testimonials columns="2" showposts="10" orderby="title"]
115
- `
116
- The example will display up to ten testimonials in two columns, in ascending alphabetical order by testimonial title.
117
-
118
- ***Service Shortcode***
119
-
120
- You can use shortcodes to embed service on posts and pages.
121
-
122
- **Embedding Service Projects**
123
-
124
- To embed service on posts and pages, first activate the Service content type on your site and add some projects to your Service.
125
-
126
- Next, add the `[services]` shortcode to a post or page. The shortcode will display projects in different ways, depending on how you use the optional attributes to customize the featured content layout.
127
-
128
- **Attributes**
129
- * display_types: display Content Types. (true/false)
130
- * display_tags: display Content Tags. (true/false)
131
- * display_content: display project content. (true/false)
132
- * include_type: display specific Content Types. Defaults to all. (comma-separated list of Content Type slugs)
133
- * include_tag: display specific Content Tags. Defaults to all. (comma-separated list of Content Tag slugs)
134
- * columns: number of columns in shortcode. Defaults to 2. (number, 1-6)
135
- * showposts: number of projects to display. Defaults to all. (number)
136
- * order: display projects in ascending or descending order. Defaults to ASC for sorting in ascending order, but you can reverse the order by using DESC to display projects in descending order instead. (ASC/DESC)
137
- * orderby: sort projects by different criteria, including author name, project title, and even rand to display in a random order. Defaults to sorting by date. (author, date, title, rand)
138
-
139
- **Example**
140
- `
141
- [services display_types="true" display_tags="false" include_type="grooming-tips,best-kitties" columns="2" showposts="10" orderby="title"]
142
- `
143
- The example will display up to ten featured content in two columns, in ascending alphabetical order by project title. It will display Content Types, hide Content Tags, and only display projects that are assigned the “Grooming Tips” or “Best Kitties” Content Types.
144
-
145
- ***Food Menu Shortcode***
146
-
147
- You can use shortcodes to embed Food Menu on posts and pages.
148
- Embedding Food Menu
149
-
150
- **Embedding Food Menu**
151
-
152
- To embed food menus on posts and pages, first activate the Food Menu custom content type on your site and add some food menus.
153
-
154
- Next, add the `[food_menu]` shortcode to a post or page. The shortcode will display food menu in the selected post or page.
155
-
156
- **Attributes**
157
- * showposts: number of menu items to display. Defaults to all. (number)
158
- * include_type: display specific Content Types. Defaults to all. (comma-separated list of Content Type slugs)
159
- * include_tag: display specific Content Tags. Defaults to all. (comma-separated list of Content Tag slugs)
160
-
161
- **Example**
162
-
163
- `[food_menu showposts="10" include_type="pizza,burger,breakfast"]`
164
- The example will display up to ten menu items. It will only display menu items in “Pizza”, “Burger” or “Breakfast” sections.
165
-
166
- == Translations ==
167
-
168
- To translate the plugin, use translate.wordpress.org (GlotPress). You only need your WordPress.org account to join the collaborative translation project.
169
-
170
- You can translate Essential Widgets on [translate.wordpress.org](https://translate.wordpress.org/projects/wp-plugins/essential-content-types/).
171
-
172
- == Installation ==
173
-
174
- The easy way (via Dashboard) :
175
-
176
- * Go to Plugins > Add New
177
- * Type in the **Essential Content Types** in Search Plugins box
178
- * Click Install Now to install the plugin
179
- * After Installation click activate to start using the **Essential Content Types**
180
- * Go to **Essential Content Types** from Dashboard menu
181
- * Use Shortcodes in your posts/pages/templates
182
-
183
- Not so easy way (via FTP) :
184
-
185
- * Download the **Essential Content Types**
186
- * Unarchive **Essential Content Types** plugin
187
- * Copy folder with `essential-content-types.zip`
188
- * Open the ftp `\wp-content\plugins\`
189
- * Paste the plug-ins folder in the folder
190
- * Go to admin panel => open item "Plugins" => activate **Essential Content Types**
191
- * Go to **Essential Content Types** from Dashboard menu
192
- * Use Shortcodes in your posts/pages/templates
193
-
194
- == Screenshots ==
195
-
196
- 1. Main Dashboard
197
- 2. Customizer: Portfolio Archive Options
198
- 3. Customizer: Testimonial Archive Options
199
- 4. Customizer: Featured Content Archive Options
200
- 5. Customizer: Services Archive Options
201
-
202
- == Changelog ==
203
- = 1.8.1 (Released: May 07, 2020) =
204
- * Added: French translation by Charles GIRARDIN
205
-
206
- = 1.8 (Released: March 17, 2020) =
207
- * Compatibility check up to version 5.4
208
-
209
- = 1.7 (Released: November 12, 2019) =
210
- * Compatibility check up to version 5.3
211
-
212
- = 1.6 (Released: August 20, 2019) =
213
- * Added: Option to turn off Catch Themes and Catch Plugins tabs
214
- * Compatibility check up to version 5.2
215
- * Updated: Adjust CPT archive and custom taxonomies to obey CPT reading setting
216
-
217
-
218
- = 1.5.1 (Released: April 09, 2019) =
219
- * Added: Excerpt support for CPT
220
- * Updated: Catch Themes and Catch Plugins tabs displaying code
221
-
222
- = 1.5 (Released: February 21, 2019) =
223
- * Compatibility check up to version 5.1
224
-
225
- = 1.4 (Released: December 12, 2018) =
226
- * Added: Catch Themes and Catch Plugins tabs in Add themes and Add plugins page respectively
227
- * Added: Themes by Catch Themes section under Themes panel in customizer
228
- * Bug Fixed: Undefined index when no section is selected for food items
229
- * Compatibility check up to version 5.0
230
- * Updated: How to use link
231
-
232
- = 1.3 (Released: July 05, 2018) =
233
- * Added: Default featured-image-size
234
- * Bug fixed: settings_page function found
235
- * Changed: function name changed to settings_page
236
- * Updated: Html structure
237
-
238
- = 1.2 (Released: May 07, 2018) =
239
- * Updated: Moved domain from catchthemes.com to catchplugins.com
240
- * Compatibility check up to version 4.9.5
241
-
242
- = 1.1 =
243
- * Removed: Unnecessary code hiding menu price in Food Menu CPT
244
-
245
- = 1.0.9 =
246
- * Added: CPT-Food Menu Items
247
- * Compatibility check up to version 4.9.4
248
- * Update: Moved all plugin customizer options to new panel Essential Content Types Plugin Options
249
-
250
- = 1.0.8 =
251
- * Compatibility check up to version 4.9
252
-
253
- = 1.0.7 =
254
- * Added: Action links in plugin page
255
- * Added: Restrict activation if Pro version is active
256
- * Updated: Plugin page and reivew links
257
-
258
- = 1.0.6 =
259
- * Added: Screenshots: Services Archive Option
260
- * Bug Fixed: Services Archive option in Customizer
261
- * Bug Fixed: Link to Services Archive option in Dashboard
262
-
263
- = 1.0.5 =
264
- * Added: Custom Post Type: Service
265
- * Added: Position in Testimonials
266
-
267
- = 1.0.3 & 1.0.4 =
268
- * Shortcode instruction link added
269
-
270
- = 1.0.2 =
271
- * Checked: Version compatibility WordPress 4.8
272
- * Renamed Featured Content to ECT: Featured Content
273
-
274
- = 1.0.1 =
275
- * Bug Fixed: Featured Content compatibility with themes with Jetpack: Featured Content Support
276
- * Bug Fixed: Admin CSS
277
-
278
- = 1.0.0 =
279
- * Initial Release
 
 
 
1
+ === Essential Content Types ===
2
+ Contributors: catchplugins, catchthemes, sakinshrestha, pratikshrestha, maheshmaharjan, dreamsapana
3
+ Donate link: https://catchplugins.com/plugins/essential-content-types-pro/
4
+ Tags: custom post types, CPT, CMS, post, types, post type, taxonomy, tax, custom, content types, post types, custom content types, testimonial, portfolio, featured content, service
5
+ Requires at least: 4.8
6
+ Tested up to: 5.5
7
+ Stable tag: trunk
8
+ License: GPLv3 or later
9
+ License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
+
11
+ Essential Content Types allows you to feature the impressive content through different content/post types on your website just the way you want it. These content/post types are missed by the themes in WordPress Theme Directory as the feature falls more towards the plugins’ territory.
12
+
13
+ == Description ==
14
+
15
+ **Essential Content Types** allows you to feature the impressive content through different content/post types on your website just the way you want it. These content/post types are missed by the themes in WordPress Theme Directory as the feature falls more towards the plugins' territory.
16
+
17
+ Content is at the forefront of any website. Changing the layout of your important content changes the way your website looks, which may not be a plus point if your current website layout is loved by your users.
18
+
19
+ Additionally, switching themes changes your website layout completely. Therefore, to keep things looking spic-and- span in your website, we bring you Essential Content.
20
+
21
+ Essential Content allows you to add up to three content/post types:
22
+ * Portfolio – Create and display your portfolio on your website
23
+ * Testimonials – Add customer testimonials to your website
24
+ * Featured Content – Display the content you want as featured content on your website to attract visitors' attention
25
+ * Services – Add your services on your website
26
+
27
+ Features of Essential Content:
28
+ * Enable/Disable any content/post type as needed
29
+ * Light-weight
30
+ * Supports all themes on WordPress
31
+
32
+ Essential Content is inspired by *Jetpack's Custom Content Types feature*.
33
+
34
+ However, not everyone wants to have a plugin that “does-it- all”. Some may want plugins to be niche focused and concentrate on smaller areas.
35
+
36
+ That is precisely what we have done with Essential Content. Essential content, true to its name, has only the essential elements. We have added the features that WordPressers use most. We have ruled out all other elements to make it non-bloated and clean. It takes up lesser space and does the job well.
37
+
38
+ If you think we have missed any essential content/post types, please let us know. We’ll review the frequency of usage and add your suggestions.
39
+
40
+ ***Portfolio Shortcode***
41
+
42
+ You can use shortcodes to embed portfolio projects on posts and pages.
43
+
44
+ **Embedding Portfolio Projects**
45
+
46
+ To embed portfolio projects on posts and pages, first activate the Portfolio custom content type on your site and add some projects to your portfolio.
47
+
48
+ Next, add the `[portfolio]` shortcode to a post or page. The shortcode will display projects in different ways, depending on how you use the optional attributes to customize the portfolio layout.
49
+
50
+ **Attributes**
51
+ * display_types: display Project Types. (true/false)
52
+ * display_tags: display Project Tags. (true/false)
53
+ * display_content: display project content. (true/false)
54
+ * include_type: display specific Project Types. Defaults to all. (comma-separated list of Project Type slugs)
55
+ * include_tag: display specific Project Tags. Defaults to all. (comma-separated list of Project Tag slugs)
56
+ * columns: number of columns in shortcode. Defaults to 2. (number, 1-6)
57
+ * showposts: number of projects to display. Defaults to all. (number)
58
+ * order: display projects in ascending or descending order. Defaults to ASC for sorting in ascending order, but you can reverse the order by using DESC to display projects in descending order instead. (ASC/DESC)
59
+ * orderby: sort projects by different criteria, including author name, project title, and even rand to display in a random order. Defaults to sorting by date. (author, date, title, rand)
60
+
61
+ **Example**
62
+ `
63
+ [portfolio display_types="true" display_tags="false" include_type="grooming-tips,best-kitties" columns="2" showposts="10" orderby="title"]
64
+ `
65
+ The example will display up to ten portfolio projects in two columns, in ascending alphabetical order by project title. It will display Project Types, hide Project Tags, and only display projects that are assigned the “Grooming Tips” or “Best Kitties” Project Types.
66
+
67
+
68
+ ***Featured Content Shortcode***
69
+
70
+ You can use shortcodes to embed featured content on posts and pages.
71
+
72
+ **Embedding Featured Content Projects**
73
+
74
+ To embed featured content on posts and pages, first activate the Featured Content content type on your site and add some projects to your featured content.
75
+
76
+ Next, add the `[featured_content]` shortcode to a post or page. The shortcode will display projects in different ways, depending on how you use the optional attributes to customize the featured content layout.
77
+
78
+ **Attributes**
79
+ * display_types: display Content Types. (true/false)
80
+ * display_tags: display Content Tags. (true/false)
81
+ * display_content: display project content. (true/false)
82
+ * include_type: display specific Content Types. Defaults to all. (comma-separated list of Content Type slugs)
83
+ * include_tag: display specific Content Tags. Defaults to all. (comma-separated list of Content Tag slugs)
84
+ * columns: number of columns in shortcode. Defaults to 2. (number, 1-6)
85
+ * showposts: number of projects to display. Defaults to all. (number)
86
+ * order: display projects in ascending or descending order. Defaults to ASC for sorting in ascending order, but you can reverse the order by using DESC to display projects in descending order instead. (ASC/DESC)
87
+ * orderby: sort projects by different criteria, including author name, project title, and even rand to display in a random order. Defaults to sorting by date. (author, date, title, rand)
88
+
89
+ **Example**
90
+ `
91
+ [featured_content display_types="true" display_tags="false" include_type="grooming-tips,best-kitties" columns="2" showposts="10" orderby="title"]
92
+ `
93
+ The example will display up to ten featured content in two columns, in ascending alphabetical order by project title. It will display Content Types, hide Content Tags, and only display projects that are assigned the “Grooming Tips” or “Best Kitties” Content Types.
94
+
95
+ ***Testimonials Shortcode***
96
+
97
+ You can use shortcodes to embed testimonials on posts and pages.
98
+ Embedding Testimonials
99
+
100
+ To embed testimonials on posts and pages, first activate the Testimonial custom content type on your site and add some testimonials.
101
+
102
+ Next, add the `[testimonials]` shortcode to a post or page. The shortcode will display testimonials in different ways, depending on how you use the optional attributes to customize the testimonials layout.
103
+
104
+ **Attributes**
105
+ * display_content: display testimonial content. (full/true/false)
106
+ * image: display the featured image. (true/false) Defaults to true.
107
+ * columns: number of columns in shortcode. Defaults to 1. (number, 1-6)
108
+ * showposts: number of testimonials to display. Defaults to all. (number)
109
+ * order: display testimonials in ascending or descending chronological order. Defaults to ASC for sorting in ascending order, but you can reverse the order by using DESC to display testimonials in descending order instead. (ASC/DESC)
110
+ * orderby: sort testimonials by different criteria, including author name, testimonial title, and even rand to display in a random order. Defaults to sorting by date. (author, date, title, rand)
111
+
112
+ **Example**
113
+ `
114
+ [testimonials columns="2" showposts="10" orderby="title"]
115
+ `
116
+ The example will display up to ten testimonials in two columns, in ascending alphabetical order by testimonial title.
117
+
118
+ ***Service Shortcode***
119
+
120
+ You can use shortcodes to embed service on posts and pages.
121
+
122
+ **Embedding Service Projects**
123
+
124
+ To embed service on posts and pages, first activate the Service content type on your site and add some projects to your Service.
125
+
126
+ Next, add the `[services]` shortcode to a post or page. The shortcode will display projects in different ways, depending on how you use the optional attributes to customize the featured content layout.
127
+
128
+ **Attributes**
129
+ * display_types: display Content Types. (true/false)
130
+ * display_tags: display Content Tags. (true/false)
131
+ * display_content: display project content. (true/false)
132
+ * include_type: display specific Content Types. Defaults to all. (comma-separated list of Content Type slugs)
133
+ * include_tag: display specific Content Tags. Defaults to all. (comma-separated list of Content Tag slugs)
134
+ * columns: number of columns in shortcode. Defaults to 2. (number, 1-6)
135
+ * showposts: number of projects to display. Defaults to all. (number)
136
+ * order: display projects in ascending or descending order. Defaults to ASC for sorting in ascending order, but you can reverse the order by using DESC to display projects in descending order instead. (ASC/DESC)
137
+ * orderby: sort projects by different criteria, including author name, project title, and even rand to display in a random order. Defaults to sorting by date. (author, date, title, rand)
138
+
139
+ **Example**
140
+ `
141
+ [services display_types="true" display_tags="false" include_type="grooming-tips,best-kitties" columns="2" showposts="10" orderby="title"]
142
+ `
143
+ The example will display up to ten featured content in two columns, in ascending alphabetical order by project title. It will display Content Types, hide Content Tags, and only display projects that are assigned the “Grooming Tips” or “Best Kitties” Content Types.
144
+
145
+ ***Food Menu Shortcode***
146
+
147
+ You can use shortcodes to embed Food Menu on posts and pages.
148
+ Embedding Food Menu
149
+
150
+ **Embedding Food Menu**
151
+
152
+ To embed food menus on posts and pages, first activate the Food Menu custom content type on your site and add some food menus.
153
+
154
+ Next, add the `[food_menu]` shortcode to a post or page. The shortcode will display food menu in the selected post or page.
155
+
156
+ **Attributes**
157
+ * showposts: number of menu items to display. Defaults to all. (number)
158
+ * include_type: display specific Content Types. Defaults to all. (comma-separated list of Content Type slugs)
159
+ * include_tag: display specific Content Tags. Defaults to all. (comma-separated list of Content Tag slugs)
160
+
161
+ **Example**
162
+
163
+ `[food_menu showposts="10" include_type="pizza,burger,breakfast"]`
164
+ The example will display up to ten menu items. It will only display menu items in “Pizza”, “Burger” or “Breakfast” sections.
165
+
166
+ == Translations ==
167
+
168
+ To translate the plugin, use translate.wordpress.org (GlotPress). You only need your WordPress.org account to join the collaborative translation project.
169
+
170
+ You can translate Essential Widgets on [translate.wordpress.org](https://translate.wordpress.org/projects/wp-plugins/essential-content-types/).
171
+
172
+ == Installation ==
173
+
174
+ The easy way (via Dashboard) :
175
+
176
+ * Go to Plugins > Add New
177
+ * Type in the **Essential Content Types** in Search Plugins box
178
+ * Click Install Now to install the plugin
179
+ * After Installation click activate to start using the **Essential Content Types**
180
+ * Go to **Essential Content Types** from Dashboard menu
181
+ * Use Shortcodes in your posts/pages/templates
182
+
183
+ Not so easy way (via FTP) :
184
+
185
+ * Download the **Essential Content Types**
186
+ * Unarchive **Essential Content Types** plugin
187
+ * Copy folder with `essential-content-types.zip`
188
+ * Open the ftp `\wp-content\plugins\`
189
+ * Paste the plug-ins folder in the folder
190
+ * Go to admin panel => open item "Plugins" => activate **Essential Content Types**
191
+ * Go to **Essential Content Types** from Dashboard menu
192
+ * Use Shortcodes in your posts/pages/templates
193
+
194
+ == Screenshots ==
195
+
196
+ 1. Main Dashboard
197
+ 2. Customizer: Portfolio Archive Options
198
+ 3. Customizer: Testimonial Archive Options
199
+ 4. Customizer: Featured Content Archive Options
200
+ 5. Customizer: Services Archive Options
201
+
202
+ == Changelog ==
203
+ = 1.8.2 (Released: Aug 19, 2020) ==
204
+ * Bug Fixed: Issue in add new theme page
205
+
206
+ = 1.8.1 (Released: May 07, 2020) =
207
+ * Added: French translation by Charles GIRARDIN
208
+
209
+ = 1.8 (Released: March 17, 2020) =
210
+ * Compatibility check up to version 5.4
211
+
212
+ = 1.7 (Released: November 12, 2019) =
213
+ * Compatibility check up to version 5.3
214
+
215
+ = 1.6 (Released: August 20, 2019) =
216
+ * Added: Option to turn off Catch Themes and Catch Plugins tabs
217
+ * Compatibility check up to version 5.2
218
+ * Updated: Adjust CPT archive and custom taxonomies to obey CPT reading setting
219
+
220
+
221
+ = 1.5.1 (Released: April 09, 2019) =
222
+ * Added: Excerpt support for CPT
223
+ * Updated: Catch Themes and Catch Plugins tabs displaying code
224
+
225
+ = 1.5 (Released: February 21, 2019) =
226
+ * Compatibility check up to version 5.1
227
+
228
+ = 1.4 (Released: December 12, 2018) =
229
+ * Added: Catch Themes and Catch Plugins tabs in Add themes and Add plugins page respectively
230
+ * Added: Themes by Catch Themes section under Themes panel in customizer
231
+ * Bug Fixed: Undefined index when no section is selected for food items
232
+ * Compatibility check up to version 5.0
233
+ * Updated: How to use link
234
+
235
+ = 1.3 (Released: July 05, 2018) =
236
+ * Added: Default featured-image-size
237
+ * Bug fixed: settings_page function found
238
+ * Changed: function name changed to settings_page
239
+ * Updated: Html structure
240
+
241
+ = 1.2 (Released: May 07, 2018) =
242
+ * Updated: Moved domain from catchthemes.com to catchplugins.com
243
+ * Compatibility check up to version 4.9.5
244
+
245
+ = 1.1 =
246
+ * Removed: Unnecessary code hiding menu price in Food Menu CPT
247
+
248
+ = 1.0.9 =
249
+ * Added: CPT-Food Menu Items
250
+ * Compatibility check up to version 4.9.4
251
+ * Update: Moved all plugin customizer options to new panel Essential Content Types Plugin Options
252
+
253
+ = 1.0.8 =
254
+ * Compatibility check up to version 4.9
255
+
256
+ = 1.0.7 =
257
+ * Added: Action links in plugin page
258
+ * Added: Restrict activation if Pro version is active
259
+ * Updated: Plugin page and reivew links
260
+
261
+ = 1.0.6 =
262
+ * Added: Screenshots: Services Archive Option
263
+ * Bug Fixed: Services Archive option in Customizer
264
+ * Bug Fixed: Link to Services Archive option in Dashboard
265
+
266
+ = 1.0.5 =
267
+ * Added: Custom Post Type: Service
268
+ * Added: Position in Testimonials
269
+
270
+ = 1.0.3 & 1.0.4 =
271
+ * Shortcode instruction link added
272
+
273
+ = 1.0.2 =
274
+ * Checked: Version compatibility WordPress 4.8
275
+ * Renamed Featured Content to ECT: Featured Content
276
+
277
+ = 1.0.1 =
278
+ * Bug Fixed: Featured Content compatibility with themes with Jetpack: Featured Content Support
279
+ * Bug Fixed: Admin CSS
280
+
281
+ = 1.0.0 =
282
+ * Initial Release
essential-content-types.php CHANGED
@@ -1,200 +1,200 @@
1
- <?php
2
-
3
- /**
4
- * The plugin bootstrap file
5
- *
6
- * This file is read by WordPress to generate the plugin information in the plugin
7
- * admin area. This file also includes all of the dependencies used by the plugin,
8
- * registers the activation and deactivation functions, and defines a function
9
- * that starts the plugin.
10
- *
11
- * @link https://catchplugins.com
12
- * @since 1.0.0
13
- * @package Essential_Content_Types
14
- *
15
- * @wordpress-plugin
16
- * Plugin Name: Essential Content Types
17
- * Plugin URI: https://catchplugins.com/plugins/essential-content-types/
18
- * Description: Essential Content Types allows you to feature the impressive content through different content/post types on your website just the way you want it. These content/post types are missed by the themes in WordPress Theme Directory as the feature falls more towards the plugins’ territory.
19
- * Version: 1.8.1
20
- * Author: Catch Plugins
21
- * Author URI: https://catchplugins.com
22
- * License: GPL-3.0+
23
- * License URI: http://www.gnu.org/licenses/gpl-3.0.txt
24
- * Text Domain: essential-content-types
25
- * Domain Path: /languages
26
- */
27
-
28
- // If this file is called directly, abort.
29
- if ( ! defined( 'WPINC' ) ) {
30
- die;
31
- }
32
-
33
- // Define Version
34
- define( 'ESSENTIAL_CONTENT_TYPES_VERSION', '1.8.1' );
35
-
36
- /**
37
- * The code that runs during plugin activation.
38
- * This action is documented in includes/class-essential-content-types-activator.php
39
- */
40
- // The URL of the directory that contains the plugin
41
- if ( ! defined( 'ESSENTIAL_CONTENT_TYPES_URL' ) ) {
42
- define( 'ESSENTIAL_CONTENT_TYPES_URL', plugin_dir_url( __FILE__ ) );
43
- }
44
-
45
-
46
- // The absolute path of the directory that contains the file
47
- if ( ! defined( 'ESSENTIAL_CONTENT_TYPES_PATH' ) ) {
48
- define( 'ESSENTIAL_CONTENT_TYPES_PATH', plugin_dir_path( __FILE__ ) );
49
- }
50
-
51
-
52
- // Gets the path to a plugin file or directory, relative to the plugins directory, without the leading and trailing slashes.
53
- if ( ! defined( 'ESSENTIAL_CONTENT_TYPES_BASENAME' ) ) {
54
- define( 'ESSENTIAL_CONTENT_TYPES_BASENAME', plugin_basename( __FILE__ ) );
55
- }
56
-
57
- /**
58
- * Make plugin available for translation
59
- * Translations can be filed in the /languages/ directory
60
- */
61
- function activate_essential_content_types() {
62
- $required = 'essential-content-types-pro/essential-content-types-pro.php';
63
- if ( is_plugin_active( $required ) ) {
64
- $message = esc_html__( 'Sorry, Pro plugin is already active. No need to activate Free version. %1$s&laquo; Return to Plugins%2$s.', 'essential-content-types' );
65
- $message = sprintf( $message, '<br><a href="' . esc_url( admin_url( 'plugins.php' ) ) . '">', '</a>' );
66
- wp_die( $message );
67
- }
68
- require_once plugin_dir_path( __FILE__ ) . 'includes/class-essential-content-types-activator.php';
69
- Essential_Content_Types_Activator::activate();
70
- }
71
-
72
- /**
73
- * The code that runs during plugin deactivation.
74
- * This action is documented in includes/class-essential-content-types-deactivator.php
75
- */
76
- function deactivate_essential_content_types() {
77
- require_once plugin_dir_path( __FILE__ ) . 'includes/class-essential-content-types-deactivator.php';
78
- Essential_Content_Types_Deactivator::deactivate();
79
- }
80
-
81
- register_activation_hook( __FILE__, 'activate_essential_content_types' );
82
- register_deactivation_hook( __FILE__, 'deactivate_essential_content_types' );
83
-
84
- /**
85
- * The core plugin class that is used to define internationalization,
86
- * admin-specific hooks, and public-facing site hooks.
87
- */
88
- require plugin_dir_path( __FILE__ ) . 'includes/class-essential-content-types.php';
89
-
90
- /**
91
- * Begins execution of the plugin.
92
- *
93
- * Since everything within the plugin is registered via hooks,
94
- * then kicking off the plugin from this point in the file does
95
- * not affect the page life cycle.
96
- *
97
- * @since 1.0.0
98
- */
99
- function run_essential_content_types() {
100
-
101
- $plugin = new Essential_Content_Types();
102
- $plugin->run();
103
-
104
- }
105
- run_essential_content_types();
106
-
107
-
108
- if ( ! function_exists( 'ect_get_layout' ) ) :
109
- function ect_get_layout() {
110
- $layout = array(
111
- '1' => 'layout-one',
112
- '2' => 'layout-two',
113
- '3' => 'layout-three',
114
- '4' => 'layout-four',
115
- '5' => 'layout-five',
116
- '6' => 'layout-six',
117
- );
118
- return $layout;
119
- }
120
- endif;
121
-
122
-
123
- if ( ! function_exists( 'ect_plugin_path' ) ) :
124
- /**
125
- * Get the plugin path.
126
- *
127
- * @return string
128
- */
129
- function ect_plugin_path() {
130
- return untrailingslashit( plugin_dir_path( __FILE__ ) );
131
- }
132
- endif;
133
-
134
-
135
- if ( ! function_exists( 'ect_template_path' ) ) :
136
- /**
137
- * Get the template path.
138
- *
139
- * @return string
140
- */
141
- function ect_template_path() {
142
- return apply_filters( 'ect_template_path', 'ect-templates/' );
143
- }
144
- endif;
145
-
146
-
147
- if ( ! function_exists( 'ect_get_template_part' ) ) :
148
- /**
149
- * Get template part (for templates like the shop-loop).
150
- *
151
- *
152
- * @access public
153
- * @param mixed $slug Template slug.
154
- * @param string $name Template name (default: '').
155
- * @param array $atts Options to pass into template.
156
- */
157
- function ect_get_template_part( $slug, $name = '', $atts ) {
158
-
159
- $template = '';
160
- set_query_var( 'atts', $atts );
161
-
162
- // Look in yourtheme/slug-name.php and yourtheme/ect-templates/slug-name.php.
163
- if ( $name ) {
164
- $template = locate_template( array( "{$slug}-{$name}.php", ect_template_path() . "{$slug}-{$name}.php" ) );
165
- }
166
-
167
- // Get default slug-name.php.
168
- if ( empty( $template ) && $name && file_exists( ect_plugin_path() . '/' . ect_template_path() . "{$slug}-{$name}.php" ) ) {
169
- $template = ect_plugin_path() . '/' . ect_template_path() . "{$slug}-{$name}.php";
170
- }
171
-
172
- // If template file doesn't exist, look in yourtheme/slug.php and yourtheme/ect-templates/slug.php.
173
- if ( ! $template ) {
174
- $template = locate_template( array( "{$slug}.php", ect_template_path() . "{$slug}.php" ) );
175
- }
176
-
177
- // Allow 3rd party plugins to filter template file from their plugin.
178
- $template = apply_filters( 'ect_get_template_part', $template, $slug, $name );
179
-
180
- if ( $template ) {
181
- load_template( $template, false, 'atts' );
182
- }
183
- }
184
- endif;
185
-
186
- function ect_body_classes( $classes ) {
187
- $classes[] = 'ect-post';
188
- return $classes;
189
- }
190
- add_filter( 'body_class', 'ect_body_classes' );
191
- /* CTP tabs removal options */
192
- require plugin_dir_path( __FILE__ ) . '/includes/ctp-tabs-removal.php';
193
-
194
- $ctp_options = ctp_get_options();
195
- if ( 1 == $ctp_options['theme_plugin_tabs'] ) {
196
- /* Adds Catch Themes tab in Add theme page and Themes by Catch Themes in Customizer's change theme option. */
197
- if ( ! class_exists( 'CatchThemesThemePlugin' ) && ! function_exists( 'add_our_plugins_tab' ) ) {
198
- require plugin_dir_path( __FILE__ ) . '/includes/CatchThemesThemePlugin.php';
199
- }
200
- }
1
+ <?php
2
+
3
+ /**
4
+ * The plugin bootstrap file
5
+ *
6
+ * This file is read by WordPress to generate the plugin information in the plugin
7
+ * admin area. This file also includes all of the dependencies used by the plugin,
8
+ * registers the activation and deactivation functions, and defines a function
9
+ * that starts the plugin.
10
+ *
11
+ * @link https://catchplugins.com
12
+ * @since 1.0.0
13
+ * @package Essential_Content_Types
14
+ *
15
+ * @wordpress-plugin
16
+ * Plugin Name: Essential Content Types
17
+ * Plugin URI: https://catchplugins.com/plugins/essential-content-types/
18
+ * Description: Essential Content Types allows you to feature the impressive content through different content/post types on your website just the way you want it. These content/post types are missed by the themes in WordPress Theme Directory as the feature falls more towards the plugins’ territory.
19
+ * Version: 1.8.2
20
+ * Author: Catch Plugins
21
+ * Author URI: https://catchplugins.com
22
+ * License: GPL-3.0+
23
+ * License URI: http://www.gnu.org/licenses/gpl-3.0.txt
24
+ * Text Domain: essential-content-types
25
+ * Domain Path: /languages
26
+ */
27
+
28
+ // If this file is called directly, abort.
29
+ if ( ! defined( 'WPINC' ) ) {
30
+ die;
31
+ }
32
+
33
+ // Define Version
34
+ define( 'ESSENTIAL_CONTENT_TYPES_VERSION', '1.8.2' );
35
+
36
+ /**
37
+ * The code that runs during plugin activation.
38
+ * This action is documented in includes/class-essential-content-types-activator.php
39
+ */
40
+ // The URL of the directory that contains the plugin
41
+ if ( ! defined( 'ESSENTIAL_CONTENT_TYPES_URL' ) ) {
42
+ define( 'ESSENTIAL_CONTENT_TYPES_URL', plugin_dir_url( __FILE__ ) );
43
+ }
44
+
45
+
46
+ // The absolute path of the directory that contains the file
47
+ if ( ! defined( 'ESSENTIAL_CONTENT_TYPES_PATH' ) ) {
48
+ define( 'ESSENTIAL_CONTENT_TYPES_PATH', plugin_dir_path( __FILE__ ) );
49
+ }
50
+
51
+
52
+ // Gets the path to a plugin file or directory, relative to the plugins directory, without the leading and trailing slashes.
53
+ if ( ! defined( 'ESSENTIAL_CONTENT_TYPES_BASENAME' ) ) {
54
+ define( 'ESSENTIAL_CONTENT_TYPES_BASENAME', plugin_basename( __FILE__ ) );
55
+ }
56
+
57
+ /**
58
+ * Make plugin available for translation
59
+ * Translations can be filed in the /languages/ directory
60
+ */
61
+ function activate_essential_content_types() {
62
+ $required = 'essential-content-types-pro/essential-content-types-pro.php';
63
+ if ( is_plugin_active( $required ) ) {
64
+ $message = esc_html__( 'Sorry, Pro plugin is already active. No need to activate Free version. %1$s&laquo; Return to Plugins%2$s.', 'essential-content-types' );
65
+ $message = sprintf( $message, '<br><a href="' . esc_url( admin_url( 'plugins.php' ) ) . '">', '</a>' );
66
+ wp_die( $message );
67
+ }
68
+ require_once plugin_dir_path( __FILE__ ) . 'includes/class-essential-content-types-activator.php';
69
+ Essential_Content_Types_Activator::activate();
70
+ }
71
+
72
+ /**
73
+ * The code that runs during plugin deactivation.
74
+ * This action is documented in includes/class-essential-content-types-deactivator.php
75
+ */
76
+ function deactivate_essential_content_types() {
77
+ require_once plugin_dir_path( __FILE__ ) . 'includes/class-essential-content-types-deactivator.php';
78
+ Essential_Content_Types_Deactivator::deactivate();
79
+ }
80
+
81
+ register_activation_hook( __FILE__, 'activate_essential_content_types' );
82
+ register_deactivation_hook( __FILE__, 'deactivate_essential_content_types' );
83
+
84
+ /**
85
+ * The core plugin class that is used to define internationalization,
86
+ * admin-specific hooks, and public-facing site hooks.
87
+ */
88
+ require plugin_dir_path( __FILE__ ) . 'includes/class-essential-content-types.php';
89
+
90
+ /**
91
+ * Begins execution of the plugin.
92
+ *
93
+ * Since everything within the plugin is registered via hooks,
94
+ * then kicking off the plugin from this point in the file does
95
+ * not affect the page life cycle.
96
+ *
97
+ * @since 1.0.0
98
+ */
99
+ function run_essential_content_types() {
100
+
101
+ $plugin = new Essential_Content_Types();
102
+ $plugin->run();
103
+
104
+ }
105
+ run_essential_content_types();
106
+
107
+
108
+ if ( ! function_exists( 'ect_get_layout' ) ) :
109
+ function ect_get_layout() {
110
+ $layout = array(
111
+ '1' => 'layout-one',
112
+ '2' => 'layout-two',
113
+ '3' => 'layout-three',
114
+ '4' => 'layout-four',
115
+ '5' => 'layout-five',
116
+ '6' => 'layout-six',
117
+ );
118
+ return $layout;
119
+ }
120
+ endif;
121
+
122
+
123
+ if ( ! function_exists( 'ect_plugin_path' ) ) :
124
+ /**
125
+ * Get the plugin path.
126
+ *
127
+ * @return string
128
+ */
129
+ function ect_plugin_path() {
130
+ return untrailingslashit( plugin_dir_path( __FILE__ ) );
131
+ }
132
+ endif;
133
+
134
+
135
+ if ( ! function_exists( 'ect_template_path' ) ) :
136
+ /**
137
+ * Get the template path.
138
+ *
139
+ * @return string
140
+ */
141
+ function ect_template_path() {
142
+ return apply_filters( 'ect_template_path', 'ect-templates/' );
143
+ }
144
+ endif;
145
+
146
+
147
+ if ( ! function_exists( 'ect_get_template_part' ) ) :
148
+ /**
149
+ * Get template part (for templates like the shop-loop).
150
+ *
151
+ *
152
+ * @access public
153
+ * @param mixed $slug Template slug.
154
+ * @param string $name Template name (default: '').
155
+ * @param array $atts Options to pass into template.
156
+ */
157
+ function ect_get_template_part( $slug, $name = '', $atts ) {
158
+
159
+ $template = '';
160
+ set_query_var( 'atts', $atts );
161
+
162
+ // Look in yourtheme/slug-name.php and yourtheme/ect-templates/slug-name.php.
163
+ if ( $name ) {
164
+ $template = locate_template( array( "{$slug}-{$name}.php", ect_template_path() . "{$slug}-{$name}.php" ) );
165
+ }
166
+
167
+ // Get default slug-name.php.
168
+ if ( empty( $template ) && $name && file_exists( ect_plugin_path() . '/' . ect_template_path() . "{$slug}-{$name}.php" ) ) {
169
+ $template = ect_plugin_path() . '/' . ect_template_path() . "{$slug}-{$name}.php";
170
+ }
171
+
172
+ // If template file doesn't exist, look in yourtheme/slug.php and yourtheme/ect-templates/slug.php.
173
+ if ( ! $template ) {
174
+ $template = locate_template( array( "{$slug}.php", ect_template_path() . "{$slug}.php" ) );
175
+ }
176
+
177
+ // Allow 3rd party plugins to filter template file from their plugin.
178
+ $template = apply_filters( 'ect_get_template_part', $template, $slug, $name );
179
+
180
+ if ( $template ) {
181
+ load_template( $template, false, 'atts' );
182
+ }
183
+ }
184
+ endif;
185
+
186
+ function ect_body_classes( $classes ) {
187
+ $classes[] = 'ect-post';
188
+ return $classes;
189
+ }
190
+ add_filter( 'body_class', 'ect_body_classes' );
191
+ /* CTP tabs removal options */
192
+ require plugin_dir_path( __FILE__ ) . '/includes/ctp-tabs-removal.php';
193
+
194
+ $ctp_options = ctp_get_options();
195
+ if ( 1 == $ctp_options['theme_plugin_tabs'] ) {
196
+ /* Adds Catch Themes tab in Add theme page and Themes by Catch Themes in Customizer's change theme option. */
197
+ if ( ! class_exists( 'CatchThemesThemePlugin' ) && ! function_exists( 'add_our_plugins_tab' ) ) {
198
+ require plugin_dir_path( __FILE__ ) . '/includes/CatchThemesThemePlugin.php';
199
+ }
200
+ }
includes/CatchThemesThemePlugin.php CHANGED
@@ -1,448 +1,484 @@
1
- <?php
2
-
3
- Class CatchThemesThemePlugin {
4
- public function __construct(){
5
- remove_action( 'wp_ajax_query-themes', array( $this, 'wp_ajax_query_themes' ), 1 );
6
- add_action( 'wp_ajax_query-themes', array( $this, 'wp_ajax_custom_query_themes' ), 1 );
7
-
8
- add_action( 'admin_enqueue_scripts', array( $this, 'our_themes_script' ) );
9
-
10
- if ( ! is_multisite() ) {
11
- add_action( 'customize_register', array( $this, 'customize_register' ) );
12
- }
13
-
14
- global $wp_customize;
15
- remove_action( 'wp_ajax_customize_load_themes', array( $wp_customize, 'handle_load_themes_request' ) );
16
- add_action( 'wp_ajax_customize_load_themes', array( $this, 'handle_load_themes_request' ) );
17
-
18
- add_filter( 'install_plugins_tabs', array( $this, 'add_our_plugins_tab' ), 1 );
19
- add_filter( "install_plugins_table_api_args_catchplugins", array( $this, 'catchplugins' ), 1 );
20
- add_action( 'install_plugins_catchplugins', array( $this, 'plugins_table' ) );
21
- }
22
-
23
- /* Adds Catch Themes tab in Add Theme page to show all themes by Catch Themes in wordpress.org */
24
- public function wp_ajax_custom_query_themes() {
25
- global $themes_allowedtags, $theme_field_defaults;
26
-
27
- if ( ! current_user_can( 'install_themes' ) ) {
28
- wp_send_json_error();
29
- }
30
-
31
- $args = wp_parse_args( wp_unslash( $_REQUEST['request'] ), array(
32
- 'per_page' => 20,
33
- 'fields' => $theme_field_defaults
34
- ) );
35
-
36
- if ( isset( $args['browse'] ) && 'catchthemes' === $args['browse'] && ! isset( $args['user'] ) ) {
37
- $args['author'] = 'catchthemes';
38
- }
39
-
40
- if ( isset( $args['browse'] ) && 'favorites' === $args['browse'] && ! isset( $args['user'] ) ) {
41
- $user = get_user_option( 'wporg_favorites' );
42
- if ( $user ) {
43
- $args['user'] = $user;
44
- }
45
- }
46
-
47
- $old_filter = isset( $args['browse'] ) ? $args['browse'] : 'search';
48
-
49
- /** This filter is documented in wp-admin/includes/class-wp-theme-install-list-table.php */
50
- $args = apply_filters( 'install_themes_table_api_args_' . $old_filter, $args );
51
-
52
- $api = themes_api( 'query_themes', $args );
53
-
54
- if ( is_wp_error( $api ) ) {
55
- wp_send_json_error();
56
- }
57
-
58
- $update_php = network_admin_url( 'update.php?action=install-theme' );
59
- foreach ( $api->themes as &$theme ) {
60
- $theme->install_url = add_query_arg( array(
61
- 'theme' => $theme->slug,
62
- '_wpnonce' => wp_create_nonce( 'install-theme_' . $theme->slug )
63
- ), $update_php );
64
-
65
- if ( current_user_can( 'switch_themes' ) ) {
66
- if ( is_multisite() ) {
67
- $theme->activate_url = add_query_arg( array(
68
- 'action' => 'enable',
69
- '_wpnonce' => wp_create_nonce( 'enable-theme_' . $theme->slug ),
70
- 'theme' => $theme->slug,
71
- ), network_admin_url( 'themes.php' ) );
72
- } else {
73
- $theme->activate_url = add_query_arg( array(
74
- 'action' => 'activate',
75
- '_wpnonce' => wp_create_nonce( 'switch-theme_' . $theme->slug ),
76
- 'stylesheet' => $theme->slug,
77
- ), admin_url( 'themes.php' ) );
78
- }
79
- }
80
-
81
- if ( ! is_multisite() && current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) {
82
- $theme->customize_url = add_query_arg( array(
83
- 'return' => urlencode( network_admin_url( 'theme-install.php', 'relative' ) ),
84
- ), wp_customize_url( $theme->slug ) );
85
- }
86
-
87
- $theme->name = wp_kses( $theme->name, $themes_allowedtags );
88
- $theme->author = wp_kses( $theme->author, $themes_allowedtags );
89
- $theme->version = wp_kses( $theme->version, $themes_allowedtags );
90
- $theme->description = wp_kses( $theme->description, $themes_allowedtags );
91
- $theme->stars = wp_star_rating( array( 'rating' => $theme->rating, 'type' => 'percent', 'number' => $theme->num_ratings, 'echo' => false ) );
92
- $theme->num_ratings = number_format_i18n( $theme->num_ratings );
93
- $theme->preview_url = set_url_scheme( $theme->preview_url );
94
- }
95
-
96
- wp_send_json_success( $api );
97
- }
98
-
99
- public function our_themes_script( $hook_suffix ) {
100
-
101
- if( 'theme-install.php' == $hook_suffix ) {
102
- wp_enqueue_script( 'our-themes-script', plugin_dir_url( __FILE__ ) . '../admin/js/our-themes.js', array( 'jquery' ), '2018-05-16' );
103
- }
104
- }
105
-
106
- /* Add Catch Themes Section in Theme in Customizer */
107
- public function customize_register($wp_customize) {
108
- $wp_customize->add_section( new WP_Customize_Themes_Section( $wp_customize, 'catchthemes', array(
109
- 'title' => __( 'Themes by CatchThemes', 'catch-themes-demo-import' ),
110
- 'action' => 'catchthemes',
111
- 'capability' => 'install_themes',
112
- 'panel' => 'themes',
113
- 'priority' => 6,
114
- ) ) );
115
- }
116
-
117
-
118
-
119
-
120
- /**
121
- * Load themes into the theme browsing/installation UI.
122
- * taken from wp-includes/cllass-wp-customize-manager.php
123
- * @since 4.9.0
124
- */
125
- public function handle_load_themes_request() {
126
- check_ajax_referer( 'switch_themes', 'nonce' );
127
- if ( ! current_user_can( 'switch_themes' ) ) {
128
- wp_die( -1 );
129
- }
130
-
131
- if ( empty( $_POST['theme_action'] ) ) {
132
- wp_send_json_error( 'missing_theme_action' );
133
- }
134
- $theme_action = sanitize_key( $_POST['theme_action'] );
135
- $themes = array();
136
- $args = array();
137
-
138
- // Define query filters based on user input.
139
- if ( ! array_key_exists( 'search', $_POST ) ) {
140
- $args['search'] = '';
141
- } else {
142
- $args['search'] = sanitize_text_field( wp_unslash( $_POST['search'] ) );
143
- }
144
-
145
- if ( ! array_key_exists( 'tags', $_POST ) ) {
146
- $args['tag'] = '';
147
- } else {
148
- $args['tag'] = array_map( 'sanitize_text_field', wp_unslash( (array) $_POST['tags'] ) );
149
- }
150
-
151
- if ( ! array_key_exists( 'page', $_POST ) ) {
152
- $args['page'] = 1;
153
- } else {
154
- $args['page'] = absint( $_POST['page'] );
155
- }
156
-
157
- require_once ABSPATH . 'wp-admin/includes/theme.php';
158
-
159
- if ( 'installed' === $theme_action ) {
160
-
161
- // Load all installed themes from wp_prepare_themes_for_js().
162
- $themes = array( 'themes' => wp_prepare_themes_for_js() );
163
- foreach ( $themes['themes'] as &$theme ) {
164
- $theme['type'] = 'installed';
165
- $theme['active'] = ( isset( $_POST['customized_theme'] ) && $_POST['customized_theme'] === $theme['id'] );
166
- }
167
-
168
- } elseif ( 'catchthemes' === $theme_action ) {
169
-
170
- // Load WordPress.org themes from the .org API and normalize data to match installed theme objects.
171
- if ( ! current_user_can( 'install_themes' ) ) {
172
- wp_die( -1 );
173
- }
174
-
175
- // Arguments for all queries.
176
- $wporg_args = array(
177
- 'per_page' => -1,
178
- 'fields' => array(
179
- 'screenshot_url' => true,
180
- 'description' => true,
181
- 'rating' => true,
182
- 'downloaded' => true,
183
- 'downloadlink' => true,
184
- 'last_updated' => true,
185
- 'homepage' => true,
186
- 'num_ratings' => true,
187
- 'tags' => true,
188
- 'parent' => true,
189
- // 'extended_author' => true, @todo: WordPress.org throws a 500 server error when this is here.
190
- ),
191
- );
192
-
193
- $args = array_merge( $wporg_args, $args );
194
-
195
- if ( '' === $args['search'] && '' === $args['tag'] ) {
196
- $args['browse'] = 'new'; // Sort by latest themes by default.
197
- }
198
-
199
- $args['author'] = 'catchthemes';
200
-
201
- // Load themes from the .org API.
202
- $themes = themes_api( 'query_themes', $args );
203
- if ( is_wp_error( $themes ) ) {
204
- wp_send_json_error();
205
- }
206
-
207
- // This list matches the allowed tags in wp-admin/includes/theme-install.php.
208
- $themes_allowedtags = array_fill_keys(
209
- array( 'a', 'abbr', 'acronym', 'code', 'pre', 'em', 'strong', 'div', 'p', 'ul', 'ol', 'li', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'img' ),
210
- array()
211
- );
212
- $themes_allowedtags['a'] = array_fill_keys( array( 'href', 'title', 'target' ), true );
213
- $themes_allowedtags['acronym']['title'] = true;
214
- $themes_allowedtags['abbr']['title'] = true;
215
- $themes_allowedtags['img'] = array_fill_keys( array( 'src', 'class', 'alt' ), true );
216
-
217
- // Prepare a list of installed themes to check against before the loop.
218
- $installed_themes = array();
219
- $wp_themes = wp_get_themes();
220
- foreach ( $wp_themes as $theme ) {
221
- $installed_themes[] = $theme->get_stylesheet();
222
- }
223
- $update_php = network_admin_url( 'update.php?action=install-theme' );
224
-
225
- // Set up properties for themes available on WordPress.org.
226
- foreach ( $themes->themes as &$theme ) {
227
- $theme->install_url = add_query_arg( array(
228
- 'theme' => $theme->slug,
229
- '_wpnonce' => wp_create_nonce( 'install-theme_' . $theme->slug ),
230
- ), $update_php );
231
-
232
- $theme->name = wp_kses( $theme->name, $themes_allowedtags );
233
- $theme->author = wp_kses( $theme->author, $themes_allowedtags );
234
- $theme->version = wp_kses( $theme->version, $themes_allowedtags );
235
- $theme->description = wp_kses( $theme->description, $themes_allowedtags );
236
- $theme->tags = implode( ', ', $theme->tags );
237
- $theme->stars = wp_star_rating( array(
238
- 'rating' => $theme->rating,
239
- 'type' => 'percent',
240
- 'number' => $theme->num_ratings,
241
- 'echo' => false,
242
- ) );
243
- $theme->num_ratings = number_format_i18n( $theme->num_ratings );
244
- $theme->preview_url = set_url_scheme( $theme->preview_url );
245
-
246
- // Handle themes that are already installed as installed themes.
247
- if ( in_array( $theme->slug, $installed_themes, true ) ) {
248
- $theme->type = 'installed';
249
- } else {
250
- $theme->type = $theme_action;
251
- }
252
-
253
- // Set active based on customized theme.
254
- $theme->active = ( isset( $_POST['customized_theme'] ) && $_POST['customized_theme'] === $theme->slug );
255
-
256
- // Map available theme properties to installed theme properties.
257
- $theme->id = $theme->slug;
258
- $theme->screenshot = array( $theme->screenshot_url );
259
- $theme->authorAndUri = $theme->author;
260
- // The .org API can return the full parent theme details if passed the 'parent' arg, or if passed the 'template' option it'll return that in the event it's a child theme.
261
- if ( isset( $theme->parent ) ) {
262
- $theme->parent = $theme->parent['slug'];
263
- } else {
264
- $theme->parent = false;
265
- }
266
- unset( $theme->slug );
267
- unset( $theme->screenshot_url );
268
- unset( $theme->author );
269
- } // End foreach().
270
- } elseif ( 'wporg' === $theme_action ) {
271
-
272
- // Load WordPress.org themes from the .org API and normalize data to match installed theme objects.
273
- if ( ! current_user_can( 'install_themes' ) ) {
274
- wp_die( -1 );
275
- }
276
-
277
- // Arguments for all queries.
278
- $wporg_args = array(
279
- 'per_page' => 100,
280
- 'fields' => array(
281
- 'screenshot_url' => true,
282
- 'description' => true,
283
- 'rating' => true,
284
- 'downloaded' => true,
285
- 'downloadlink' => true,
286
- 'last_updated' => true,
287
- 'homepage' => true,
288
- 'num_ratings' => true,
289
- 'tags' => true,
290
- 'parent' => true,
291
- // 'extended_author' => true, @todo: WordPress.org throws a 500 server error when this is here.
292
- ),
293
- );
294
-
295
- $args = array_merge( $wporg_args, $args );
296
-
297
- if ( '' === $args['search'] && '' === $args['tag'] ) {
298
- $args['browse'] = 'new'; // Sort by latest themes by default.
299
- }
300
-
301
- // Load themes from the .org API.
302
- $themes = themes_api( 'query_themes', $args );
303
- if ( is_wp_error( $themes ) ) {
304
- wp_send_json_error();
305
- }
306
-
307
- // This list matches the allowed tags in wp-admin/includes/theme-install.php.
308
- $themes_allowedtags = array_fill_keys(
309
- array( 'a', 'abbr', 'acronym', 'code', 'pre', 'em', 'strong', 'div', 'p', 'ul', 'ol', 'li', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'img' ),
310
- array()
311
- );
312
- $themes_allowedtags['a'] = array_fill_keys( array( 'href', 'title', 'target' ), true );
313
- $themes_allowedtags['acronym']['title'] = true;
314
- $themes_allowedtags['abbr']['title'] = true;
315
- $themes_allowedtags['img'] = array_fill_keys( array( 'src', 'class', 'alt' ), true );
316
-
317
- // Prepare a list of installed themes to check against before the loop.
318
- $installed_themes = array();
319
- $wp_themes = wp_get_themes();
320
- foreach ( $wp_themes as $theme ) {
321
- $installed_themes[] = $theme->get_stylesheet();
322
- }
323
- $update_php = network_admin_url( 'update.php?action=install-theme' );
324
-
325
- // Set up properties for themes available on WordPress.org.
326
- foreach ( $themes->themes as &$theme ) {
327
- $theme->install_url = add_query_arg( array(
328
- 'theme' => $theme->slug,
329
- '_wpnonce' => wp_create_nonce( 'install-theme_' . $theme->slug ),
330
- ), $update_php );
331
-
332
- $theme->name = wp_kses( $theme->name, $themes_allowedtags );
333
- $theme->author = wp_kses( $theme->author, $themes_allowedtags );
334
- $theme->version = wp_kses( $theme->version, $themes_allowedtags );
335
- $theme->description = wp_kses( $theme->description, $themes_allowedtags );
336
- $theme->tags = implode( ', ', $theme->tags );
337
- $theme->stars = wp_star_rating( array(
338
- 'rating' => $theme->rating,
339
- 'type' => 'percent',
340
- 'number' => $theme->num_ratings,
341
- 'echo' => false,
342
- ) );
343
- $theme->num_ratings = number_format_i18n( $theme->num_ratings );
344
- $theme->preview_url = set_url_scheme( $theme->preview_url );
345
-
346
- // Handle themes that are already installed as installed themes.
347
- if ( in_array( $theme->slug, $installed_themes, true ) ) {
348
- $theme->type = 'installed';
349
- } else {
350
- $theme->type = $theme_action;
351
- }
352
-
353
- // Set active based on customized theme.
354
- $theme->active = ( isset( $_POST['customized_theme'] ) && $_POST['customized_theme'] === $theme->slug );
355
-
356
- // Map available theme properties to installed theme properties.
357
- $theme->id = $theme->slug;
358
- $theme->screenshot = array( $theme->screenshot_url );
359
- $theme->authorAndUri = $theme->author;
360
- // The .org API can return the full parent theme details if passed the 'parent' arg, or if passed the 'template' option it'll return that in the event it's a child theme.
361
- if ( isset( $theme->parent ) ) {
362
- $theme->parent = $theme->parent['slug'];
363
- } else {
364
- $theme->parent = false;
365
- }
366
- unset( $theme->slug );
367
- unset( $theme->screenshot_url );
368
- unset( $theme->author );
369
- } // End foreach().
370
- } // End if().
371
-
372
- /**
373
- * Filters the theme data loaded in the customizer.
374
- *
375
- * This allows theme data to be loading from an external source,
376
- * or modification of data loaded from `wp_prepare_themes_for_js()`
377
- * or WordPress.org via `themes_api()`.
378
- *
379
- * @since 4.9.0
380
- *
381
- * @see wp_prepare_themes_for_js()
382
- * @see themes_api()
383
- * @see WP_Customize_Manager::__construct()
384
- *
385
- * @param array $themes Nested array of theme data.
386
- * @param array $args List of arguments, such as page, search term, and tags to query for.
387
- * @param WP_Customize_Manager $manager Instance of Customize manager.
388
- */
389
- $themes = apply_filters( 'customize_load_themes', $themes, $args, $wp_customize );
390
-
391
- wp_send_json_success( $themes );
392
- }
393
-
394
- /* Plugins */
395
- /* Adds Catch Plugins tab in Add Plugin page to show all plugins by Catch Plugins in wordpress.org */
396
- public function add_our_plugins_tab($tabs) {
397
- // Add our filter here
398
- $tabs['catchplugins'] = _x( 'Catch Plugins', 'Plugin Installer' );
399
-
400
- return $tabs;
401
- }
402
-
403
- public function catchplugins() {
404
- /* From CORE Start */
405
- global $paged, $tab;
406
- wp_reset_vars( array( 'tab' ) );
407
-
408
- $defined_class = new WP_Plugin_Install_List_Table();
409
- $paged = $defined_class->get_pagenum();
410
-
411
- $per_page = 30;
412
- //$installed_plugins = catch_get_installed_plugins();
413
-
414
- $args = array(
415
- 'page' => $paged,
416
- 'per_page' => $per_page,
417
- 'fields' => array(
418
- 'last_updated' => true,
419
- 'icons' => true,
420
- 'active_installs' => true
421
- ),
422
- // Send the locale and installed plugin slugs to the API so it can provide context-sensitive results.
423
- 'locale' => get_user_locale(),
424
- //'installed_plugins' => array_keys( $installed_plugins ),
425
- );
426
- /* From CORE End */
427
-
428
- // Add author filter for our plugins
429
- $args['author'] = 'catchplugins';
430
-
431
- return $args;
432
- }
433
-
434
- public function plugins_table() {
435
- global $wp_list_table;
436
- printf(
437
- '<p class="catch-plugins-list">' . __( 'You can use any of our free plugins or premium plugins from <a href="%s" target="_blank">Catch Plugins</a>' ) . '.</p>',
438
- 'https://catchplugins.com/'
439
- );
440
- ?>
441
- <form id="plugin-filter" method="post">
442
- <?php $wp_list_table->display(); ?>
443
- </form>
444
- <?php
445
- }
446
- }
447
-
448
- $catchthemes_theme_plugin = new CatchThemesThemePlugin();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class CatchThemesThemePlugin {
4
+ public function __construct() {
5
+ remove_action( 'wp_ajax_query-themes', array( $this, 'wp_ajax_query_themes' ), 1 );
6
+ add_action( 'wp_ajax_query-themes', array( $this, 'wp_ajax_custom_query_themes' ), 1 );
7
+
8
+ add_action( 'admin_enqueue_scripts', array( $this, 'our_themes_script' ) );
9
+
10
+ if ( ! is_multisite() ) {
11
+ add_action( 'customize_register', array( $this, 'customize_register' ) );
12
+ }
13
+
14
+ global $wp_customize;
15
+ remove_action( 'wp_ajax_customize_load_themes', array( $wp_customize, 'handle_load_themes_request' ) );
16
+ add_action( 'wp_ajax_customize_load_themes', array( $this, 'handle_load_themes_request' ) );
17
+
18
+ add_filter( 'install_plugins_tabs', array( $this, 'add_our_plugins_tab' ), 1 );
19
+ add_filter( 'install_plugins_table_api_args_catchplugins', array( $this, 'catchplugins' ), 1 );
20
+ add_action( 'install_plugins_catchplugins', array( $this, 'plugins_table' ) );
21
+ }
22
+
23
+ /* Adds Catch Themes tab in Add Theme page to show all themes by Catch Themes in wordpress.org
24
+ * taken from wp-admin/includes/ajax-action.php wp_ajax_query_themes().
25
+ * Ajax handler for getting themes from themes_api().
26
+ *
27
+ * @since 3.9.0
28
+ *
29
+ * @global array $themes_allowedtags
30
+ * @global array $theme_field_defaults
31
+ */
32
+ public function wp_ajax_custom_query_themes() {
33
+ global $themes_allowedtags, $theme_field_defaults;
34
+
35
+ if ( ! current_user_can( 'install_themes' ) ) {
36
+ wp_send_json_error();
37
+ }
38
+
39
+ $args = wp_parse_args(
40
+ wp_unslash( $_REQUEST['request'] ),
41
+ array(
42
+ 'per_page' => 20,
43
+ 'fields' => array_merge(
44
+ (array) $theme_field_defaults,
45
+ array(
46
+ 'reviews_url' => true, // Explicitly request the reviews URL to be linked from the Add Themes screen.
47
+ )
48
+ ),
49
+ )
50
+ );
51
+
52
+ if ( isset( $args['browse'] ) && 'catchthemes' === $args['browse'] && ! isset( $args['user'] ) ) {
53
+ $args['author'] = 'catchthemes';
54
+ unset( $args['browse'] );
55
+ }
56
+
57
+ if ( isset( $args['browse'] ) && 'favorites' === $args['browse'] && ! isset( $args['user'] ) ) {
58
+ $user = get_user_option( 'wporg_favorites' );
59
+ if ( $user ) {
60
+ $args['user'] = $user;
61
+ }
62
+ }
63
+
64
+ $old_filter = isset( $args['browse'] ) ? $args['browse'] : 'search';
65
+
66
+ /** This filter is documented in wp-admin/includes/class-wp-theme-install-list-table.php */
67
+ $args = apply_filters( 'install_themes_table_api_args_' . $old_filter, $args );
68
+
69
+ $api = themes_api( 'query_themes', $args );
70
+
71
+ if ( is_wp_error( $api ) ) {
72
+ wp_send_json_error();
73
+ }
74
+
75
+ $update_php = network_admin_url( 'update.php?action=install-theme' );
76
+ foreach ( $api->themes as &$theme ) {
77
+ $theme->install_url = add_query_arg(
78
+ array(
79
+ 'theme' => $theme->slug,
80
+ '_wpnonce' => wp_create_nonce( 'install-theme_' . $theme->slug ),
81
+ ),
82
+ $update_php
83
+ );
84
+
85
+ if ( current_user_can( 'switch_themes' ) ) {
86
+ if ( is_multisite() ) {
87
+ $theme->activate_url = add_query_arg(
88
+ array(
89
+ 'action' => 'enable',
90
+ '_wpnonce' => wp_create_nonce( 'enable-theme_' . $theme->slug ),
91
+ 'theme' => $theme->slug,
92
+ ),
93
+ network_admin_url( 'themes.php' )
94
+ );
95
+ } else {
96
+ $theme->activate_url = add_query_arg(
97
+ array(
98
+ 'action' => 'activate',
99
+ '_wpnonce' => wp_create_nonce( 'switch-theme_' . $theme->slug ),
100
+ 'stylesheet' => $theme->slug,
101
+ ),
102
+ admin_url( 'themes.php' )
103
+ );
104
+ }
105
+ }
106
+
107
+ if ( ! is_multisite() && current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) {
108
+ $theme->customize_url = add_query_arg(
109
+ array(
110
+ 'return' => urlencode( network_admin_url( 'theme-install.php', 'relative' ) ),
111
+ ),
112
+ wp_customize_url( $theme->slug )
113
+ );
114
+ }
115
+
116
+ $theme->name = wp_kses( $theme->name, $themes_allowedtags );
117
+ $theme->author = wp_kses( $theme->author['display_name'], $themes_allowedtags );
118
+ $theme->version = wp_kses( $theme->version, $themes_allowedtags );
119
+ $theme->description = wp_kses( $theme->description, $themes_allowedtags );
120
+
121
+ $theme->stars = wp_star_rating(
122
+ array(
123
+ 'rating' => $theme->rating,
124
+ 'type' => 'percent',
125
+ 'number' => $theme->num_ratings,
126
+ 'echo' => false,
127
+ )
128
+ );
129
+
130
+ $theme->num_ratings = number_format_i18n( $theme->num_ratings );
131
+ $theme->preview_url = set_url_scheme( $theme->preview_url );
132
+ $theme->compatible_wp = is_wp_version_compatible( $theme->requires );
133
+ $theme->compatible_php = is_php_version_compatible( $theme->requires_php );
134
+
135
+ }
136
+
137
+ wp_send_json_success( $api );
138
+ }
139
+
140
+ public function our_themes_script( $hook_suffix ) {
141
+
142
+ if ( 'theme-install.php' === $hook_suffix ) {
143
+ wp_enqueue_script( 'our-themes-script', plugin_dir_url( __FILE__ ) . '../js/our-themes.js', array( 'jquery' ), '2018-05-16' );
144
+ }
145
+ }
146
+
147
+ /* Add Catch Themes Section in Theme in Customizer */
148
+ public function customize_register( $wp_customize ) {
149
+ $wp_customize->add_section(
150
+ new WP_Customize_Themes_Section(
151
+ $wp_customize,
152
+ 'catchthemes',
153
+ array(
154
+ 'title' => __( 'Themes by CatchThemes', 'catch-themes-demo-import' ),
155
+ 'action' => 'catchthemes',
156
+ 'capability' => 'install_themes',
157
+ 'panel' => 'themes',
158
+ 'priority' => 6,
159
+ )
160
+ )
161
+ );
162
+ }
163
+
164
+
165
+
166
+
167
+ /**
168
+ * Load themes into the theme browsing/installation UI.
169
+ * taken from wp-includes/cllass-wp-customize-manager.php
170
+ * @since 4.9.0
171
+ */
172
+ public function handle_load_themes_request() {
173
+ check_ajax_referer( 'switch_themes', 'nonce' );
174
+ if ( ! current_user_can( 'switch_themes' ) ) {
175
+ wp_die( -1 );
176
+ }
177
+
178
+ if ( empty( $_POST['theme_action'] ) ) {
179
+ wp_send_json_error( 'missing_theme_action' );
180
+ }
181
+ $theme_action = sanitize_key( $_POST['theme_action'] );
182
+ $themes = array();
183
+ $args = array();
184
+
185
+ // Define query filters based on user input.
186
+ if ( ! array_key_exists( 'search', $_POST ) ) {
187
+ $args['search'] = '';
188
+ } else {
189
+ $args['search'] = sanitize_text_field( wp_unslash( $_POST['search'] ) );
190
+ }
191
+
192
+ if ( ! array_key_exists( 'tags', $_POST ) ) {
193
+ $args['tag'] = '';
194
+ } else {
195
+ $args['tag'] = array_map( 'sanitize_text_field', wp_unslash( (array) $_POST['tags'] ) );
196
+ }
197
+
198
+ if ( ! array_key_exists( 'page', $_POST ) ) {
199
+ $args['page'] = 1;
200
+ } else {
201
+ $args['page'] = absint( $_POST['page'] );
202
+ }
203
+
204
+ require_once ABSPATH . 'wp-admin/includes/theme.php';
205
+
206
+ if ( 'installed' === $theme_action ) {
207
+
208
+ // Load all installed themes from wp_prepare_themes_for_js().
209
+ $themes = array( 'themes' => wp_prepare_themes_for_js() );
210
+ foreach ( $themes['themes'] as &$theme ) {
211
+ $theme['type'] = 'installed';
212
+ $theme['active'] = ( isset( $_POST['customized_theme'] ) && $_POST['customized_theme'] === $theme['id'] );
213
+ }
214
+ } elseif ( 'catchthemes' === $theme_action ) {
215
+
216
+ // Load WordPress.org themes from the .org API and normalize data to match installed theme objects.
217
+ if ( ! current_user_can( 'install_themes' ) ) {
218
+ wp_die( -1 );
219
+ }
220
+
221
+ // Arguments for all queries.
222
+ $wporg_args = array(
223
+ 'per_page' => 100,
224
+ 'fields' => array(
225
+ 'reviews_url' => true, // Explicitly request the reviews URL to be linked from the customizer.
226
+ ),
227
+ );
228
+
229
+ $args = array_merge( $wporg_args, $args );
230
+
231
+ if ( '' === $args['search'] && '' === $args['tag'] ) {
232
+ $args['browse'] = 'new'; // Sort by latest themes by default.
233
+ }
234
+
235
+ $args['author'] = 'catchthemes';
236
+
237
+ // Load themes from the .org API.
238
+ $themes = themes_api( 'query_themes', $args );
239
+ if ( is_wp_error( $themes ) ) {
240
+ wp_send_json_error();
241
+ }
242
+
243
+ // This list matches the allowed tags in wp-admin/includes/theme-install.php.
244
+ $themes_allowedtags = array_fill_keys(
245
+ array( 'a', 'abbr', 'acronym', 'code', 'pre', 'em', 'strong', 'div', 'p', 'ul', 'ol', 'li', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'img' ),
246
+ array()
247
+ );
248
+ $themes_allowedtags['a'] = array_fill_keys( array( 'href', 'title', 'target' ), true );
249
+ $themes_allowedtags['acronym']['title'] = true;
250
+ $themes_allowedtags['abbr']['title'] = true;
251
+ $themes_allowedtags['img'] = array_fill_keys( array( 'src', 'class', 'alt' ), true );
252
+
253
+ // Prepare a list of installed themes to check against before the loop.
254
+ $installed_themes = array();
255
+ $wp_themes = wp_get_themes();
256
+ foreach ( $wp_themes as $theme ) {
257
+ $installed_themes[] = $theme->get_stylesheet();
258
+ }
259
+ $update_php = network_admin_url( 'update.php?action=install-theme' );
260
+
261
+ // Set up properties for themes available on WordPress.org.
262
+ foreach ( $themes->themes as &$theme ) {
263
+ $theme->install_url = add_query_arg(
264
+ array(
265
+ 'theme' => $theme->slug,
266
+ '_wpnonce' => wp_create_nonce( 'install-theme_' . $theme->slug ),
267
+ ),
268
+ $update_php
269
+ );
270
+
271
+ $theme->name = wp_kses( $theme->name, $themes_allowedtags );
272
+ $theme->version = wp_kses( $theme->version, $themes_allowedtags );
273
+ $theme->description = wp_kses( $theme->description, $themes_allowedtags );
274
+ $theme->stars = wp_star_rating(
275
+ array(
276
+ 'rating' => $theme->rating,
277
+ 'type' => 'percent',
278
+ 'number' => $theme->num_ratings,
279
+ 'echo' => false,
280
+ )
281
+ );
282
+ $theme->num_ratings = number_format_i18n( $theme->num_ratings );
283
+ $theme->preview_url = set_url_scheme( $theme->preview_url );
284
+
285
+ // Handle themes that are already installed as installed themes.
286
+ if ( in_array( $theme->slug, $installed_themes, true ) ) {
287
+ $theme->type = 'installed';
288
+ } else {
289
+ $theme->type = $theme_action;
290
+ }
291
+
292
+ // Set active based on customized theme.
293
+ $theme->active = ( isset( $_POST['customized_theme'] ) && $_POST['customized_theme'] === $theme->slug );
294
+
295
+ // Map available theme properties to installed theme properties.
296
+ $theme->id = $theme->slug;
297
+ $theme->screenshot = array( $theme->screenshot_url );
298
+ $theme->authorAndUri = wp_kses( $theme->author['display_name'], $themes_allowedtags );
299
+ $theme->compatibleWP = is_wp_version_compatible( $theme->requires ); // phpcs:ignore WordPress.NamingConventions.ValidVariableName
300
+ $theme->compatiblePHP = is_php_version_compatible( $theme->requires_php ); // phpcs:ignore WordPress.NamingConventions.ValidVariableName
301
+
302
+ if ( isset( $theme->parent ) ) {
303
+ $theme->parent = $theme->parent['slug'];
304
+ } else {
305
+ $theme->parent = false;
306
+ }
307
+ unset( $theme->slug );
308
+ unset( $theme->screenshot_url );
309
+ unset( $theme->author );
310
+ } // End foreach().
311
+ } elseif ( 'wporg' === $theme_action ) {
312
+
313
+ // Load WordPress.org themes from the .org API and normalize data to match installed theme objects.
314
+ if ( ! current_user_can( 'install_themes' ) ) {
315
+ wp_die( -1 );
316
+ }
317
+
318
+ // Arguments for all queries.
319
+ $wporg_args = array(
320
+ 'per_page' => 100,
321
+ 'fields' => array(
322
+ 'reviews_url' => true, // Explicitly request the reviews URL to be linked from the customizer.
323
+ ),
324
+ );
325
+
326
+ $args = array_merge( $wporg_args, $args );
327
+
328
+ if ( '' === $args['search'] && '' === $args['tag'] ) {
329
+ $args['browse'] = 'new'; // Sort by latest themes by default.
330
+ }
331
+
332
+ // Load themes from the .org API.
333
+ $themes = themes_api( 'query_themes', $args );
334
+ if ( is_wp_error( $themes ) ) {
335
+ wp_send_json_error();
336
+ }
337
+
338
+ // This list matches the allowed tags in wp-admin/includes/theme-install.php.
339
+ $themes_allowedtags = array_fill_keys(
340
+ array( 'a', 'abbr', 'acronym', 'code', 'pre', 'em', 'strong', 'div', 'p', 'ul', 'ol', 'li', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'img' ),
341
+ array()
342
+ );
343
+ $themes_allowedtags['a'] = array_fill_keys( array( 'href', 'title', 'target' ), true );
344
+ $themes_allowedtags['acronym']['title'] = true;
345
+ $themes_allowedtags['abbr']['title'] = true;
346
+ $themes_allowedtags['img'] = array_fill_keys( array( 'src', 'class', 'alt' ), true );
347
+
348
+ // Prepare a list of installed themes to check against before the loop.
349
+ $installed_themes = array();
350
+ $wp_themes = wp_get_themes();
351
+ foreach ( $wp_themes as $theme ) {
352
+ $installed_themes[] = $theme->get_stylesheet();
353
+ }
354
+ $update_php = network_admin_url( 'update.php?action=install-theme' );
355
+
356
+ // Set up properties for themes available on WordPress.org.
357
+ foreach ( $themes->themes as &$theme ) {
358
+ $theme->install_url = add_query_arg(
359
+ array(
360
+ 'theme' => $theme->slug,
361
+ '_wpnonce' => wp_create_nonce( 'install-theme_' . $theme->slug ),
362
+ ),
363
+ $update_php
364
+ );
365
+
366
+ $theme->name = wp_kses( $theme->name, $themes_allowedtags );
367
+ $theme->version = wp_kses( $theme->version, $themes_allowedtags );
368
+ $theme->description = wp_kses( $theme->description, $themes_allowedtags );
369
+ $theme->stars = wp_star_rating(
370
+ array(
371
+ 'rating' => $theme->rating,
372
+ 'type' => 'percent',
373
+ 'number' => $theme->num_ratings,
374
+ 'echo' => false,
375
+ )
376
+ );
377
+ $theme->num_ratings = number_format_i18n( $theme->num_ratings );
378
+ $theme->preview_url = set_url_scheme( $theme->preview_url );
379
+
380
+ // Handle themes that are already installed as installed themes.
381
+ if ( in_array( $theme->slug, $installed_themes, true ) ) {
382
+ $theme->type = 'installed';
383
+ } else {
384
+ $theme->type = $theme_action;
385
+ }
386
+
387
+ // Set active based on customized theme.
388
+ $theme->active = ( isset( $_POST['customized_theme'] ) && $_POST['customized_theme'] === $theme->slug );
389
+
390
+ // Map available theme properties to installed theme properties.
391
+ $theme->id = $theme->slug;
392
+ $theme->screenshot = array( $theme->screenshot_url );
393
+ $theme->authorAndUri = wp_kses( $theme->author['display_name'], $themes_allowedtags );
394
+ $theme->compatibleWP = is_wp_version_compatible( $theme->requires ); // phpcs:ignore WordPress.NamingConventions.ValidVariableName
395
+ $theme->compatiblePHP = is_php_version_compatible( $theme->requires_php ); // phpcs:ignore WordPress.NamingConventions.ValidVariableName
396
+
397
+ if ( isset( $theme->parent ) ) {
398
+ $theme->parent = $theme->parent['slug'];
399
+ } else {
400
+ $theme->parent = false;
401
+ }
402
+ unset( $theme->slug );
403
+ unset( $theme->screenshot_url );
404
+ unset( $theme->author );
405
+ } // End foreach().
406
+ } // End if().
407
+
408
+ /**
409
+ * Filters the theme data loaded in the customizer.
410
+ *
411
+ * This allows theme data to be loading from an external source,
412
+ * or modification of data loaded from `wp_prepare_themes_for_js()`
413
+ * or WordPress.org via `themes_api()`.
414
+ *
415
+ * @since 4.9.0
416
+ *
417
+ * @see wp_prepare_themes_for_js()
418
+ * @see themes_api()
419
+ * @see WP_Customize_Manager::__construct()
420
+ *
421
+ * @param array $themes Nested array of theme data.
422
+ * @param array $args List of arguments, such as page, search term, and tags to query for.
423
+ * @param WP_Customize_Manager $manager Instance of Customize manager.
424
+ */
425
+ $themes = apply_filters( 'customize_load_themes', $themes, $args, $wp_customize );
426
+
427
+ wp_send_json_success( $themes );
428
+ }
429
+
430
+ /* Plugins */
431
+ /* Adds Catch Plugins tab in Add Plugin page to show all plugins by Catch Plugins in wordpress.org */
432
+ public function add_our_plugins_tab( $tabs ) {
433
+ // Add our filter here
434
+ $tabs['catchplugins'] = _x( 'Catch Plugins', 'Plugin Installer' );
435
+
436
+ return $tabs;
437
+ }
438
+
439
+ public function catchplugins() {
440
+ /* From CORE Start */
441
+ global $paged, $tab;
442
+ wp_reset_vars( array( 'tab' ) );
443
+
444
+ $defined_class = new WP_Plugin_Install_List_Table();
445
+ $paged = $defined_class->get_pagenum();
446
+
447
+ $per_page = 30;
448
+ //$installed_plugins = catch_get_installed_plugins();
449
+
450
+ $args = array(
451
+ 'page' => $paged,
452
+ 'per_page' => $per_page,
453
+ 'fields' => array(
454
+ 'last_updated' => true,
455
+ 'icons' => true,
456
+ 'active_installs' => true,
457
+ ),
458
+ // Send the locale and installed plugin slugs to the API so it can provide context-sensitive results.
459
+ 'locale' => get_user_locale(),
460
+ //'installed_plugins' => array_keys( $installed_plugins ),
461
+ );
462
+ /* From CORE End */
463
+
464
+ // Add author filter for our plugins
465
+ $args['author'] = 'catchplugins';
466
+
467
+ return $args;
468
+ }
469
+
470
+ public function plugins_table() {
471
+ global $wp_list_table;
472
+ printf(
473
+ '<p class="catch-plugins-list">' . __( 'You can use any of our free plugins or premium plugins from <a href="%s" target="_blank">Catch Plugins</a>' ) . '.</p>',
474
+ 'https://catchplugins.com/'
475
+ );
476
+ ?>
477
+ <form id="plugin-filter" method="post">
478
+ <?php $wp_list_table->display(); ?>
479
+ </form>
480
+ <?php
481
+ }
482
+ }
483
+
484
+ $catchthemes_theme_plugin = new CatchThemesThemePlugin();
languages/essential-content-types-fr_FR.mo CHANGED
Binary file
languages/essential-content-types-fr_FR.po CHANGED
@@ -4,8 +4,8 @@ msgid ""
4
  msgstr ""
5
  "Project-Id-Version: Essential Content Types\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/tags/_s\n"
7
- "POT-Creation-Date: 2020-05-07 15:24-0700\n"
8
- "PO-Revision-Date: 2020-05-07 15:24-0700\n"
9
  "Last-Translator: Charles Girardin <girardin.charles.57@gmail.com>\n"
10
  "Language-Team: Catch Plugins <info@catchplugins.com>\n"
11
  "Language: fr_FR\n"
@@ -13,7 +13,7 @@ msgstr ""
13
  "Content-Type: text/plain; charset=UTF-8\n"
14
  "Content-Transfer-Encoding: 8bit\n"
15
  "Plural-Forms: nplurals=2; plural=(n > 1);\n"
16
- "X-Generator: Poedit 2.3\n"
17
  "X-Poedit-KeywordsList: __;_e;_n:1,2;_x:1,2c;esc_attr_e;esc_attr__;_nx;_x;"
18
  "esc_html_e;esc_html__;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2;_n_noop:1,2;"
19
  "__ngettext_noop:1,2;_c,_nc:4c,1,2\n"
@@ -1939,16 +1939,16 @@ msgstr ""
1939
  "Désolé, le plugin Pro est déjà actif. Il n'est pas nécessaire d'activer la "
1940
  "version gratuite. %1$s&laquo; Retour aux Plugins%2$s."
1941
 
1942
- #: ../includes/CatchThemesThemePlugin.php:109
1943
  msgid "Themes by CatchThemes"
1944
  msgstr "Thèmes par CatchThemes"
1945
 
1946
- #: ../includes/CatchThemesThemePlugin.php:398
1947
  msgctxt "Plugin Installer"
1948
  msgid "Catch Plugins"
1949
  msgstr "Catch Plugins"
1950
 
1951
- #: ../includes/CatchThemesThemePlugin.php:437
1952
  #, php-format
1953
  msgid ""
1954
  "You can use any of our free plugins or premium plugins from <a href=\"%s\" "
4
  msgstr ""
5
  "Project-Id-Version: Essential Content Types\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/tags/_s\n"
7
+ "POT-Creation-Date: 2020-08-19 14:29-0400\n"
8
+ "PO-Revision-Date: 2020-08-19 14:29-0400\n"
9
  "Last-Translator: Charles Girardin <girardin.charles.57@gmail.com>\n"
10
  "Language-Team: Catch Plugins <info@catchplugins.com>\n"
11
  "Language: fr_FR\n"
13
  "Content-Type: text/plain; charset=UTF-8\n"
14
  "Content-Transfer-Encoding: 8bit\n"
15
  "Plural-Forms: nplurals=2; plural=(n > 1);\n"
16
+ "X-Generator: Poedit 2.4.1\n"
17
  "X-Poedit-KeywordsList: __;_e;_n:1,2;_x:1,2c;esc_attr_e;esc_attr__;_nx;_x;"
18
  "esc_html_e;esc_html__;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2;_n_noop:1,2;"
19
  "__ngettext_noop:1,2;_c,_nc:4c,1,2\n"
1939
  "Désolé, le plugin Pro est déjà actif. Il n'est pas nécessaire d'activer la "
1940
  "version gratuite. %1$s&laquo; Retour aux Plugins%2$s."
1941
 
1942
+ #: ../includes/CatchThemesThemePlugin.php:154
1943
  msgid "Themes by CatchThemes"
1944
  msgstr "Thèmes par CatchThemes"
1945
 
1946
+ #: ../includes/CatchThemesThemePlugin.php:434
1947
  msgctxt "Plugin Installer"
1948
  msgid "Catch Plugins"
1949
  msgstr "Catch Plugins"
1950
 
1951
+ #: ../includes/CatchThemesThemePlugin.php:473
1952
  #, php-format
1953
  msgid ""
1954
  "You can use any of our free plugins or premium plugins from <a href=\"%s\" "
languages/essential-content-types.pot CHANGED
@@ -5,7 +5,7 @@ msgid ""
5
  msgstr ""
6
  "Project-Id-Version: Essential Content Types\n"
7
  "Report-Msgid-Bugs-To: https://wordpress.org/tags/_s\n"
8
- "POT-Creation-Date: 2020-05-07 15:24-0700\n"
9
  "PO-Revision-Date: 2016-12-12 09:23-0500\n"
10
  "Last-Translator: Sakin Shrestha <info@catchplugins.com>\n"
11
  "Language-Team: Catch Plugins <info@catchplugins.com>\n"
@@ -14,7 +14,7 @@ msgstr ""
14
  "Content-Type: text/plain; charset=UTF-8\n"
15
  "Content-Transfer-Encoding: 8bit\n"
16
  "Plural-Forms: nplurals=2; plural=n != 1;\n"
17
- "X-Generator: Poedit 2.3\n"
18
  "X-Poedit-KeywordsList: __;_e;_n:1,2;_x:1,2c;esc_attr_e;esc_attr__;_nx;_x;"
19
  "esc_html_e;esc_html__;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2;_n_noop:1,2;"
20
  "__ngettext_noop:1,2;_c,_nc:4c,1,2\n"
@@ -1806,16 +1806,16 @@ msgid ""
1806
  "%1$s&laquo; Return to Plugins%2$s."
1807
  msgstr ""
1808
 
1809
- #: ../includes/CatchThemesThemePlugin.php:109
1810
  msgid "Themes by CatchThemes"
1811
  msgstr ""
1812
 
1813
- #: ../includes/CatchThemesThemePlugin.php:398
1814
  msgctxt "Plugin Installer"
1815
  msgid "Catch Plugins"
1816
  msgstr ""
1817
 
1818
- #: ../includes/CatchThemesThemePlugin.php:437
1819
  #, php-format
1820
  msgid ""
1821
  "You can use any of our free plugins or premium plugins from <a href=\"%s\" "
5
  msgstr ""
6
  "Project-Id-Version: Essential Content Types\n"
7
  "Report-Msgid-Bugs-To: https://wordpress.org/tags/_s\n"
8
+ "POT-Creation-Date: 2020-08-19 14:29-0400\n"
9
  "PO-Revision-Date: 2016-12-12 09:23-0500\n"
10
  "Last-Translator: Sakin Shrestha <info@catchplugins.com>\n"
11
  "Language-Team: Catch Plugins <info@catchplugins.com>\n"
14
  "Content-Type: text/plain; charset=UTF-8\n"
15
  "Content-Transfer-Encoding: 8bit\n"
16
  "Plural-Forms: nplurals=2; plural=n != 1;\n"
17
+ "X-Generator: Poedit 2.4.1\n"
18
  "X-Poedit-KeywordsList: __;_e;_n:1,2;_x:1,2c;esc_attr_e;esc_attr__;_nx;_x;"
19
  "esc_html_e;esc_html__;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2;_n_noop:1,2;"
20
  "__ngettext_noop:1,2;_c,_nc:4c,1,2\n"
1806
  "%1$s&laquo; Return to Plugins%2$s."
1807
  msgstr ""
1808
 
1809
+ #: ../includes/CatchThemesThemePlugin.php:154
1810
  msgid "Themes by CatchThemes"
1811
  msgstr ""
1812
 
1813
+ #: ../includes/CatchThemesThemePlugin.php:434
1814
  msgctxt "Plugin Installer"
1815
  msgid "Catch Plugins"
1816
  msgstr ""
1817
 
1818
+ #: ../includes/CatchThemesThemePlugin.php:473
1819
  #, php-format
1820
  msgid ""
1821
  "You can use any of our free plugins or premium plugins from <a href=\"%s\" "