Version Description
The post status is now used for displaying the content blocks in the widget areas, only published content blocks are now displayed. Thanks to tmbdesign.co.uk for suggesting this change.
Download this release
Release Info
Developer | vanderwijk |
Plugin | Content Blocks (Custom Post Widget) |
Version | 2.7.2 |
Comparing to | |
See all releases |
Code changes from version 2.6 to 2.7.2
- custom-post-widget.php +8 -7
- languages/custom-post-widget-nl_NL.mo +0 -0
- languages/custom-post-widget-nl_NL.po +29 -16
- notice.php +24 -0
- post-widget.php +20 -17
- readme.txt +13 -11
custom-post-widget.php
CHANGED
@@ -1,14 +1,14 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
-
Plugin Name: Custom Post Widget
|
4 |
-
Plugin URI:
|
5 |
Description: Show the content of a custom post of the type 'content_block' in a widget or with a shortcode.
|
6 |
-
Version: 2.
|
7 |
-
Author:
|
8 |
-
Author URI:
|
9 |
License: GPL2
|
10 |
|
11 |
-
Release notes: Version 2.
|
12 |
|
13 |
Copyright 2014 Johan van der Wijk (email: info@vanderwijk.com)
|
14 |
|
@@ -43,4 +43,5 @@ function custom_post_widget_load_widgets() {
|
|
43 |
}
|
44 |
|
45 |
require_once( 'meta-box.php' );
|
46 |
-
require_once( 'popup.php' );
|
|
1 |
<?php
|
2 |
/*
|
3 |
+
Plugin Name: Savvii Custom Post Widget
|
4 |
+
Plugin URI: https://www.savvii.eu/wordpress-custom-post-widget/
|
5 |
Description: Show the content of a custom post of the type 'content_block' in a widget or with a shortcode.
|
6 |
+
Version: 2.7.2
|
7 |
+
Author: Savvii WordPress Hosting
|
8 |
+
Author URI: https://www.savvii.eu/
|
9 |
License: GPL2
|
10 |
|
11 |
+
Release notes: Version 2.7.2 The post status is now used for displaying the content blocks in widgets.
|
12 |
|
13 |
Copyright 2014 Johan van der Wijk (email: info@vanderwijk.com)
|
14 |
|
43 |
}
|
44 |
|
45 |
require_once( 'meta-box.php' );
|
46 |
+
require_once( 'popup.php' );
|
47 |
+
require_once( 'notice.php' );
|
languages/custom-post-widget-nl_NL.mo
CHANGED
Binary file
|
languages/custom-post-widget-nl_NL.po
CHANGED
@@ -2,7 +2,7 @@ msgid ""
|
|
2 |
msgstr ""
|
3 |
"Project-Id-Version: Custom Post Widget\n"
|
4 |
"Report-Msgid-Bugs-To: \n"
|
5 |
-
"POT-Creation-Date: 2014-
|
6 |
"PO-Revision-Date: \n"
|
7 |
"Last-Translator: Johan van der Wijk <johan@vanderwijk.nl>\n"
|
8 |
"Language-Team: Johan van der Wijk <info@vanderwijk.com>\n"
|
@@ -16,7 +16,7 @@ msgstr ""
|
|
16 |
"_n_noop:1,2;_c,_nc:4c,1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2\n"
|
17 |
"X-Poedit-Basepath: .\n"
|
18 |
"X-Textdomain-Support: yes\n"
|
19 |
-
"X-Generator: Poedit 1.6.
|
20 |
"X-Poedit-SearchPath-0: .\n"
|
21 |
"X-Poedit-SearchPath-1: ..\n"
|
22 |
|
@@ -25,6 +25,19 @@ msgstr ""
|
|
25 |
msgid "Content Block Information"
|
26 |
msgstr "Inhoudsblok Informatie"
|
27 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
# @ custom-post-widget
|
29 |
#: ../popup.php:17 ../popup.php:18
|
30 |
msgid "Add Content Block"
|
@@ -147,77 +160,77 @@ msgid "No Content Blocks found in Trash"
|
|
147 |
msgstr "Geen Inhoudsblokken in de Prullenbak"
|
148 |
|
149 |
# @ custom-post-widget
|
150 |
-
#: ../post-widget.php:
|
151 |
#, php-format
|
152 |
msgid "Content Block updated. <a href=\"%s\">Manage Widgets</a>"
|
153 |
msgstr "Inhoudsblok bijgewerkt. <a href=\"%s\">Beheer Widgets</a>"
|
154 |
|
155 |
# @ custom-post-widget
|
156 |
-
#: ../post-widget.php:
|
157 |
msgid "Content Block updated."
|
158 |
msgstr "Inhoudsblok bijgewerkt."
|
159 |
|
160 |
# @ custom-post-widget
|
161 |
-
#: ../post-widget.php:
|
162 |
msgid "Custom field updated."
|
163 |
msgstr "Custom field bijgewerkt."
|
164 |
|
165 |
# @ custom-post-widget
|
166 |
-
#: ../post-widget.php:
|
167 |
msgid "Custom field deleted."
|
168 |
msgstr "Custom field verwijderd."
|
169 |
|
170 |
# @ custom-post-widget
|
171 |
-
#: ../post-widget.php:
|
172 |
#, php-format
|
173 |
msgid "Content Block restored to revision from %s"
|
174 |
msgstr "Inhoudsblok teruggezet naar revisie %s"
|
175 |
|
176 |
# @ custom-post-widget
|
177 |
-
#: ../post-widget.php:
|
178 |
#, php-format
|
179 |
msgid "Content Block published. <a href=\"%s\">Manage Widgets</a>"
|
180 |
msgstr "Inhoudsblok gepubliceerd. <a href=\"%s\">Beheer Widgets</a>"
|
181 |
|
182 |
# @ custom-post-widget
|
183 |
-
#: ../post-widget.php:
|
184 |
msgid "Content Block published."
|
185 |
msgstr "Inhoudsblok gepubliceerd."
|
186 |
|
187 |
# @ custom-post-widget
|
188 |
-
#: ../post-widget.php:
|
189 |
msgid "Block saved."
|
190 |
msgstr "Inhoudsblok Opgeslagen."
|
191 |
|
192 |
# @ custom-post-widget
|
193 |
-
#: ../post-widget.php:
|
194 |
#, php-format
|
195 |
msgid "Content Block submitted. <a href=\"%s\">Manage Widgets</a>"
|
196 |
msgstr "Inhoudsblok toegevoegd. <a href=\"%s\">Beheer Widgets</a>"
|
197 |
|
198 |
# @ custom-post-widget
|
199 |
-
#: ../post-widget.php:
|
200 |
msgid "Content Block submitted."
|
201 |
msgstr "Inhoudsblok toegevoegd."
|
202 |
|
203 |
# @ custom-post-widget
|
204 |
-
#: ../post-widget.php:
|
205 |
#, php-format
|
206 |
msgid "Content Block scheduled for: <strong>%1$s</strong>."
|
207 |
msgstr "Inhoudsblok zal worden gepubliceerd op: <strong>%1$s</strong>."
|
208 |
|
209 |
# @ custom-post-widget
|
210 |
-
#: ../post-widget.php:
|
211 |
msgid "M j, Y @ G:i"
|
212 |
msgstr "j. M Y @ H:M"
|
213 |
|
214 |
# @ custom-post-widget
|
215 |
-
#: ../post-widget.php:
|
216 |
#, php-format
|
217 |
msgid "Content Block draft updated. <a href=\"%s\">Manage Widgets</a>"
|
218 |
msgstr "Concept Inhoudsblok Bijgewerkt. <a href=\"%s\">Beheer Widgets</a>"
|
219 |
|
220 |
# @ custom-post-widget
|
221 |
-
#: ../post-widget.php:
|
222 |
msgid "Content Block draft updated."
|
223 |
msgstr "Concept Inhoudsblok bijgewerkt."
|
2 |
msgstr ""
|
3 |
"Project-Id-Version: Custom Post Widget\n"
|
4 |
"Report-Msgid-Bugs-To: \n"
|
5 |
+
"POT-Creation-Date: 2014-12-02 16:49+0100\n"
|
6 |
"PO-Revision-Date: \n"
|
7 |
"Last-Translator: Johan van der Wijk <johan@vanderwijk.nl>\n"
|
8 |
"Language-Team: Johan van der Wijk <info@vanderwijk.com>\n"
|
16 |
"_n_noop:1,2;_c,_nc:4c,1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2\n"
|
17 |
"X-Poedit-Basepath: .\n"
|
18 |
"X-Textdomain-Support: yes\n"
|
19 |
+
"X-Generator: Poedit 1.6.10\n"
|
20 |
"X-Poedit-SearchPath-0: .\n"
|
21 |
"X-Poedit-SearchPath-1: ..\n"
|
22 |
|
25 |
msgid "Content Block Information"
|
26 |
msgstr "Inhoudsblok Informatie"
|
27 |
|
28 |
+
#: ../notice.php:11
|
29 |
+
#, php-format
|
30 |
+
msgid ""
|
31 |
+
"Thank you for using the Custom Post Widget plugin. Visit the <a href="
|
32 |
+
"\"https://www.savvii.eu/wordpress-custom-post-widget/\" target=\"_blank"
|
33 |
+
"\">Savvii website</a> to find out more about using this plugin. <a href="
|
34 |
+
"\"%1$s\" style=\"float:right;\">Hide Notice</a>"
|
35 |
+
msgstr ""
|
36 |
+
"Bedankt voor het gebruiken van de Savvii Custom Post Widget plugin. Bezoek "
|
37 |
+
"de <a href=\"https://www.savvii.eu/wordpress-custom-post-widget/\" target="
|
38 |
+
"\"_blank\">Savvii website</a> voor meer informatie over deze plugin. <a href="
|
39 |
+
"\"%1$s\" style=\"float:right;\">Verberg Bericht</a>"
|
40 |
+
|
41 |
# @ custom-post-widget
|
42 |
#: ../popup.php:17 ../popup.php:18
|
43 |
msgid "Add Content Block"
|
160 |
msgstr "Geen Inhoudsblokken in de Prullenbak"
|
161 |
|
162 |
# @ custom-post-widget
|
163 |
+
#: ../post-widget.php:151
|
164 |
#, php-format
|
165 |
msgid "Content Block updated. <a href=\"%s\">Manage Widgets</a>"
|
166 |
msgstr "Inhoudsblok bijgewerkt. <a href=\"%s\">Beheer Widgets</a>"
|
167 |
|
168 |
# @ custom-post-widget
|
169 |
+
#: ../post-widget.php:151 ../post-widget.php:154
|
170 |
msgid "Content Block updated."
|
171 |
msgstr "Inhoudsblok bijgewerkt."
|
172 |
|
173 |
# @ custom-post-widget
|
174 |
+
#: ../post-widget.php:152
|
175 |
msgid "Custom field updated."
|
176 |
msgstr "Custom field bijgewerkt."
|
177 |
|
178 |
# @ custom-post-widget
|
179 |
+
#: ../post-widget.php:153
|
180 |
msgid "Custom field deleted."
|
181 |
msgstr "Custom field verwijderd."
|
182 |
|
183 |
# @ custom-post-widget
|
184 |
+
#: ../post-widget.php:155
|
185 |
#, php-format
|
186 |
msgid "Content Block restored to revision from %s"
|
187 |
msgstr "Inhoudsblok teruggezet naar revisie %s"
|
188 |
|
189 |
# @ custom-post-widget
|
190 |
+
#: ../post-widget.php:156
|
191 |
#, php-format
|
192 |
msgid "Content Block published. <a href=\"%s\">Manage Widgets</a>"
|
193 |
msgstr "Inhoudsblok gepubliceerd. <a href=\"%s\">Beheer Widgets</a>"
|
194 |
|
195 |
# @ custom-post-widget
|
196 |
+
#: ../post-widget.php:156
|
197 |
msgid "Content Block published."
|
198 |
msgstr "Inhoudsblok gepubliceerd."
|
199 |
|
200 |
# @ custom-post-widget
|
201 |
+
#: ../post-widget.php:157
|
202 |
msgid "Block saved."
|
203 |
msgstr "Inhoudsblok Opgeslagen."
|
204 |
|
205 |
# @ custom-post-widget
|
206 |
+
#: ../post-widget.php:158
|
207 |
#, php-format
|
208 |
msgid "Content Block submitted. <a href=\"%s\">Manage Widgets</a>"
|
209 |
msgstr "Inhoudsblok toegevoegd. <a href=\"%s\">Beheer Widgets</a>"
|
210 |
|
211 |
# @ custom-post-widget
|
212 |
+
#: ../post-widget.php:158
|
213 |
msgid "Content Block submitted."
|
214 |
msgstr "Inhoudsblok toegevoegd."
|
215 |
|
216 |
# @ custom-post-widget
|
217 |
+
#: ../post-widget.php:159
|
218 |
#, php-format
|
219 |
msgid "Content Block scheduled for: <strong>%1$s</strong>."
|
220 |
msgstr "Inhoudsblok zal worden gepubliceerd op: <strong>%1$s</strong>."
|
221 |
|
222 |
# @ custom-post-widget
|
223 |
+
#: ../post-widget.php:159
|
224 |
msgid "M j, Y @ G:i"
|
225 |
msgstr "j. M Y @ H:M"
|
226 |
|
227 |
# @ custom-post-widget
|
228 |
+
#: ../post-widget.php:160
|
229 |
#, php-format
|
230 |
msgid "Content Block draft updated. <a href=\"%s\">Manage Widgets</a>"
|
231 |
msgstr "Concept Inhoudsblok Bijgewerkt. <a href=\"%s\">Beheer Widgets</a>"
|
232 |
|
233 |
# @ custom-post-widget
|
234 |
+
#: ../post-widget.php:160
|
235 |
msgid "Content Block draft updated."
|
236 |
msgstr "Concept Inhoudsblok bijgewerkt."
|
notice.php
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/* Display a notice that can be dismissed */
|
4 |
+
|
5 |
+
function cpw_admin_notice() {
|
6 |
+
global $current_user ;
|
7 |
+
$user_id = $current_user->ID;
|
8 |
+
$screen = get_current_screen();
|
9 |
+
if ( ! get_user_meta($user_id, 'cpw_notice_hidden') && ( $screen->id == 'edit-content_block' || $screen->id == 'content_block' ) ) {
|
10 |
+
echo '<div class="updated" style="border-color: #00b1ff;"><p>';
|
11 |
+
printf(__('Thank you for using the Custom Post Widget plugin. Visit the <a href="https://www.savvii.eu/wordpress-custom-post-widget/" target="_blank">Savvii website</a> to find out more about using this plugin. <a href="%1$s" style="float:right;">Hide Notice</a>'), '?post_type=content_block&cpw_hide_notice=yes');
|
12 |
+
echo "</p></div>";
|
13 |
+
}
|
14 |
+
}
|
15 |
+
add_action('admin_init', 'cpw_hide_notice');
|
16 |
+
|
17 |
+
function cpw_hide_notice() {
|
18 |
+
global $current_user;
|
19 |
+
$user_id = $current_user->ID;
|
20 |
+
if ( isset($_GET['cpw_hide_notice']) && 'yes' == $_GET['cpw_hide_notice'] ) {
|
21 |
+
add_user_meta($user_id, 'cpw_notice_hidden', 'yes', true);
|
22 |
+
}
|
23 |
+
}
|
24 |
+
add_action('admin_notices', 'cpw_admin_notice');
|
post-widget.php
CHANGED
@@ -90,25 +90,28 @@ class custom_post_widget extends WP_Widget {
|
|
90 |
$show_custom_post_title = isset( $instance['show_custom_post_title'] ) ? $instance['show_custom_post_title'] : false;
|
91 |
$show_featured_image = isset($instance['show_featured_image']) ? $instance['show_featured_image'] : false;
|
92 |
$apply_content_filters = isset($instance['apply_content_filters']) ? $instance['apply_content_filters'] : false;
|
93 |
-
$content_post = get_post($custom_post_id);
|
|
|
94 |
$content = $content_post->post_content;
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
99 |
}
|
100 |
-
if ( !$apply_content_filters ) { // Don't apply the content filter if checkbox selected
|
101 |
-
$content = apply_filters( 'the_content', $content);
|
102 |
-
}
|
103 |
-
echo $before_widget;
|
104 |
-
if ( $show_custom_post_title ) {
|
105 |
-
echo $before_title . apply_filters( 'widget_title',$content_post->post_title) . $after_title; // This is the line that displays the title (only if show title is set)
|
106 |
-
}
|
107 |
-
if ( $show_featured_image ) {
|
108 |
-
echo get_the_post_thumbnail( $content_post -> ID );
|
109 |
-
}
|
110 |
-
echo do_shortcode( $content ); // This is where the actual content of the custom post is being displayed
|
111 |
-
echo $after_widget;
|
112 |
}
|
113 |
}
|
114 |
|
90 |
$show_custom_post_title = isset( $instance['show_custom_post_title'] ) ? $instance['show_custom_post_title'] : false;
|
91 |
$show_featured_image = isset($instance['show_featured_image']) ? $instance['show_featured_image'] : false;
|
92 |
$apply_content_filters = isset($instance['apply_content_filters']) ? $instance['apply_content_filters'] : false;
|
93 |
+
$content_post = get_post( $custom_post_id );
|
94 |
+
$post_status = get_post_status( $custom_post_id );
|
95 |
$content = $content_post->post_content;
|
96 |
+
if ( $post_status == 'publish' ) {
|
97 |
+
// Display custom widget frontend
|
98 |
+
if ( $located = locate_template( 'custom-post-widget.php' ) ) {
|
99 |
+
require $located;
|
100 |
+
return;
|
101 |
+
}
|
102 |
+
if ( !$apply_content_filters ) { // Don't apply the content filter if checkbox selected
|
103 |
+
$content = apply_filters( 'the_content', $content);
|
104 |
+
}
|
105 |
+
echo $before_widget;
|
106 |
+
if ( $show_custom_post_title ) {
|
107 |
+
echo $before_title . apply_filters( 'widget_title',$content_post->post_title) . $after_title; // This is the line that displays the title (only if show title is set)
|
108 |
+
}
|
109 |
+
if ( $show_featured_image ) {
|
110 |
+
echo get_the_post_thumbnail( $content_post -> ID );
|
111 |
+
}
|
112 |
+
echo do_shortcode( $content ); // This is where the actual content of the custom post is being displayed
|
113 |
+
echo $after_widget;
|
114 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
115 |
}
|
116 |
}
|
117 |
|
readme.txt
CHANGED
@@ -1,11 +1,9 @@
|
|
1 |
-
=== Custom Post Widget ===
|
2 |
-
Contributors: vanderwijk
|
3 |
-
Author URI: http://www.vanderwijk.com/
|
4 |
-
Donate link: http://www.vanderwijk.com/wordpress/support/
|
5 |
Tags: widget, sidebar, content block, block, custom, post, shortcode, wysiwyg, wpml, featured image
|
6 |
Requires at least: 2.9.2
|
7 |
-
Tested up to: 4.
|
8 |
-
Stable tag: 2.
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
@@ -13,7 +11,7 @@ This plugin enables you to edit and display Content Blocks in a sidebar widget o
|
|
13 |
|
14 |
== Description ==
|
15 |
|
16 |
-
The Custom Post Widget allows you to display the contents of a specific custom post in a widget.
|
17 |
|
18 |
Even though you could use the text widget that comes with the default WordPress install, this plugin has some major benefits:
|
19 |
|
@@ -37,9 +35,7 @@ To add content to a widget, drag it to the required position in the sidebar and
|
|
37 |
* Russian (ru_RU) by [Vitaliy Kaplya](http://www.dasayt.com/)
|
38 |
* Swedish (sv_SE) by [Andreas Larsson](http://krokedil.se)
|
39 |
|
40 |
-
More translations are
|
41 |
-
|
42 |
-
You can find more information about this plugin and a screencast video which shows the plugin in action on the [plugin homepage](http://www.vanderwijk.com/wordpress/wordpress-custom-post-widget/).
|
43 |
|
44 |
== Screenshots ==
|
45 |
|
@@ -76,7 +72,7 @@ This plugin has built-in support for the featured image functionality on the edi
|
|
76 |
|
77 |
= My social sharing plugin adds buttons to all the Custom Post Widget areas =
|
78 |
|
79 |
-
If your social media sharing plugin adds buttons to the widget areas you could check the 'Do not apply content filters' checkbox. Note that when this is done, WordPress will also stop adding paragraph tags to your text, so use this setting with caution. It is much better to ask the developer of the social media sharing buttons plugin to correctly use the content filters (see http://pippinsplugins.com/playing-nice-with-the-content-filter/).
|
80 |
|
81 |
= The title and featured image are not displayed when using the shortcode =
|
82 |
|
@@ -108,6 +104,12 @@ Creating and supporting this plugin takes up a lot of my free time, therefore I
|
|
108 |
|
109 |
== Changelog ==
|
110 |
|
|
|
|
|
|
|
|
|
|
|
|
|
111 |
= 2.6 =
|
112 |
Added the possibility for using the content block slug in the shortcode.
|
113 |
|
1 |
+
=== Savvii Custom Post Widget ===
|
2 |
+
Contributors: savvii, vanderwijk
|
|
|
|
|
3 |
Tags: widget, sidebar, content block, block, custom, post, shortcode, wysiwyg, wpml, featured image
|
4 |
Requires at least: 2.9.2
|
5 |
+
Tested up to: 4.1
|
6 |
+
Stable tag: 2.7.2
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
11 |
|
12 |
== Description ==
|
13 |
|
14 |
+
The [Savvii Custom Post Widget](https://www.savvii.eu/wordpress-custom-post-widget/) allows you to display the contents of a specific custom post in a widget on in the content area using a shortcode.
|
15 |
|
16 |
Even though you could use the text widget that comes with the default WordPress install, this plugin has some major benefits:
|
17 |
|
35 |
* Russian (ru_RU) by [Vitaliy Kaplya](http://www.dasayt.com/)
|
36 |
* Swedish (sv_SE) by [Andreas Larsson](http://krokedil.se)
|
37 |
|
38 |
+
More translations are very welcome!
|
|
|
|
|
39 |
|
40 |
== Screenshots ==
|
41 |
|
72 |
|
73 |
= My social sharing plugin adds buttons to all the Custom Post Widget areas =
|
74 |
|
75 |
+
If your social media sharing plugin adds buttons to the widget areas you could check the 'Do not apply content filters' checkbox. Note that when this is done, WordPress will also stop adding paragraph tags to your text, so use this setting with caution. It is much better to ask the developer of the social media sharing buttons plugin to correctly use the content filters (see http://pippinsplugins.com/playing-nice-with-the-content-filter/ for more information on this).
|
76 |
|
77 |
= The title and featured image are not displayed when using the shortcode =
|
78 |
|
104 |
|
105 |
== Changelog ==
|
106 |
|
107 |
+
= 2.7.2 =
|
108 |
+
The post status is now used for displaying the content blocks in the widget areas, only published content blocks are now displayed. Thanks to tmbdesign.co.uk for suggesting this change.
|
109 |
+
|
110 |
+
= 2.7 =
|
111 |
+
Added dismissable support notification.
|
112 |
+
|
113 |
= 2.6 =
|
114 |
Added the possibility for using the content block slug in the shortcode.
|
115 |
|