Content Blocks (Custom Post Widget) - Version 2.4.1

Version Description

Download this release

Release Info

Developer vanderwijk
Plugin Icon 128x128 Content Blocks (Custom Post Widget)
Version 2.4.1
Comparing to
See all releases

Code changes from version 2.3.5 to 2.4.1

custom-post-widget.php CHANGED
@@ -3,12 +3,12 @@
3
  Plugin Name: Custom Post Widget
4
  Plugin URI: http://www.vanderwijk.com/wordpress/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.3.5
7
  Author: Johan van der Wijk
8
  Author URI: http://www.vanderwijk.com
9
  License: GPL2
10
 
11
- Release notes: Version 2.3.5 You can now use your own template for displaying the widget content
12
 
13
  Copyright 2013 Johan van der Wijk (email: info@vanderwijk.com)
14
 
@@ -40,4 +40,6 @@ function custom_post_widget_plugin_init() {
40
  function custom_post_widget_load_widgets() {
41
  require( 'post-widget.php' );
42
  register_widget( 'custom_post_widget' );
43
- }
 
 
3
  Plugin Name: Custom Post Widget
4
  Plugin URI: http://www.vanderwijk.com/wordpress/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.4.1
7
  Author: Johan van der Wijk
8
  Author URI: http://www.vanderwijk.com
9
  License: GPL2
10
 
11
+ Release notes: Version 2.4 Added an meta box for describing the content block and included sv_SE translation
12
 
13
  Copyright 2013 Johan van der Wijk (email: info@vanderwijk.com)
14
 
40
  function custom_post_widget_load_widgets() {
41
  require( 'post-widget.php' );
42
  register_widget( 'custom_post_widget' );
43
+ }
44
+
45
+ require( 'meta-box.php' );
languages/custom-post-widget-sv_SE.mo ADDED
Binary file
languages/custom-post-widget-sv_SE.po ADDED
@@ -0,0 +1,227 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: Custom Post Widget v2.3.3\n"
4
+ "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: \n"
6
+ "PO-Revision-Date: 2013-11-14 08:52:07+0000\n"
7
+ "Last-Translator: aztek <info@aztek.se>\n"
8
+ "Language-Team: \n"
9
+ "MIME-Version: 1.0\n"
10
+ "Content-Type: text/plain; charset=UTF-8\n"
11
+ "Content-Transfer-Encoding: 8bit\n"
12
+ "Plural-Forms: nplurals=2; plural=n != 1;\n"
13
+ "X-Generator: CSL v1.x\n"
14
+ "X-Poedit-Language: Swedish\n"
15
+ "X-Poedit-Country: SWEDEN\n"
16
+ "X-Poedit-SourceCharset: utf-8\n"
17
+ "X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;_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"
18
+ "X-Poedit-Basepath: ../\n"
19
+ "X-Poedit-Bookmarks: \n"
20
+ "X-Poedit-SearchPath-0: .\n"
21
+ "X-Textdomain-Support: yes"
22
+
23
+ #: popup.php:9
24
+ #@ custom-post-widget
25
+ msgid "Please select a Content Block"
26
+ msgstr "Välj ett innehållsblock"
27
+
28
+ #: popup.php:19
29
+ #: popup.php:43
30
+ #@ custom-post-widget
31
+ msgid "Insert Content Block"
32
+ msgstr "Lägg till innehållsblock"
33
+
34
+ #: popup.php:22
35
+ #@ custom-post-widget
36
+ msgid "Select a Content Block below to add it to your post or page."
37
+ msgstr "Välj ett innehållsblock nedan för att lägga till det på din sida eller inlägg."
38
+
39
+ #: popup.php:27
40
+ #@ custom-post-widget
41
+ msgid "Select a Content Block"
42
+ msgstr "Välj ett innehållsblock"
43
+
44
+ #: popup.php:37
45
+ #: post-widget.php:41
46
+ #@ custom-post-widget
47
+ msgid "No content blocks available"
48
+ msgstr "Det finns inget innehållsblock tillgängligt"
49
+
50
+ #: post-widget.php:11
51
+ #@ custom-post-widget
52
+ msgid "Displays custom post content in a widget"
53
+ msgstr "Lägg till innehållsblock i en widget"
54
+
55
+ #: post-widget.php:12
56
+ #@ custom-post-widget
57
+ msgid "Content Block"
58
+ msgstr "Innehållsblock"
59
+
60
+ #: post-widget.php:26
61
+ #@ custom-post-widget
62
+ msgid "Content Block to Display:"
63
+ msgstr "Välj innehållsblock att visa:"
64
+
65
+ #: post-widget.php:52
66
+ #: post-widget.php:120
67
+ #@ custom-post-widget
68
+ msgid "Edit Content Block"
69
+ msgstr "Redigera innehållsblock"
70
+
71
+ #: post-widget.php:58
72
+ #@ custom-post-widget
73
+ msgid "Show Post Title"
74
+ msgstr "Visa inläggets rubrik"
75
+
76
+ #: post-widget.php:63
77
+ #@ custom-post-widget
78
+ msgid "Show featured image"
79
+ msgstr "Visa utvald bild"
80
+
81
+ #: post-widget.php:68
82
+ #@ custom-post-widget
83
+ msgid "Do not apply content filters"
84
+ msgstr "Använd inte innehållsfilter"
85
+
86
+ #: post-widget.php:84
87
+ #@ custom-post-widget
88
+ msgid "Find"
89
+ msgstr "Hitta"
90
+
91
+ #: post-widget.php:115
92
+ #@ custom-post-widget
93
+ msgctxt "post type general name"
94
+ msgid "Content Blocks"
95
+ msgstr "Innehållsblock"
96
+
97
+ #: post-widget.php:116
98
+ #@ custom-post-widget
99
+ msgctxt "post type singular name"
100
+ msgid "Content Block"
101
+ msgstr "Innehållsblock"
102
+
103
+ #: post-widget.php:117
104
+ #@ custom-post-widget
105
+ msgctxt "post type plural name"
106
+ msgid "Content Blocks"
107
+ msgstr "Innehållsblock"
108
+
109
+ #: post-widget.php:118
110
+ #@ custom-post-widget
111
+ msgctxt "block"
112
+ msgid "Add Content Block"
113
+ msgstr "Lägg till innehållsblock"
114
+
115
+ #: post-widget.php:119
116
+ #@ custom-post-widget
117
+ msgid "Add New Content Block"
118
+ msgstr "Lägg till nytt innehållsblock"
119
+
120
+ #: post-widget.php:121
121
+ #@ custom-post-widget
122
+ msgid "New Content Block"
123
+ msgstr "Nytt innehållsblock"
124
+
125
+ #: post-widget.php:122
126
+ #@ custom-post-widget
127
+ msgid "View Content Block"
128
+ msgstr "Visa innehållsblock"
129
+
130
+ #: post-widget.php:123
131
+ #@ custom-post-widget
132
+ msgid "Search Content Blocks"
133
+ msgstr "Sök bland innehållsblocken"
134
+
135
+ #: post-widget.php:124
136
+ #@ custom-post-widget
137
+ msgid "No Content Blocks Found"
138
+ msgstr "Det finns inga innehållsblock"
139
+
140
+ #: post-widget.php:125
141
+ #@ custom-post-widget
142
+ msgid "No Content Blocks found in Trash"
143
+ msgstr "Det finns inga innehållsblock i papperskorgen"
144
+
145
+ #: post-widget.php:167
146
+ #, php-format
147
+ #@ custom-post-widget
148
+ msgid "Content Block updated. <a href=\"%s\">Manage Widgets</a>"
149
+ msgstr "Innehållsblocket är uppdaterat. <a href=\"%s\">Hantera widgets</a>"
150
+
151
+ #: post-widget.php:167
152
+ #: post-widget.php:170
153
+ #@ custom-post-widget
154
+ msgid "Content Block updated."
155
+ msgstr "Innehållsblocket är uppdaterat."
156
+
157
+ #: post-widget.php:168
158
+ #@ custom-post-widget
159
+ msgid "Custom field updated."
160
+ msgstr "Det anpassade fältet är uppdaterat."
161
+
162
+ #: post-widget.php:169
163
+ #@ custom-post-widget
164
+ msgid "Custom field deleted."
165
+ msgstr "Det anpassade fältet är borttaget."
166
+
167
+ #: post-widget.php:171
168
+ #, php-format
169
+ #@ custom-post-widget
170
+ msgid "Content Block restored to revision from %s"
171
+ msgstr "Innehållsblocket är återställt från en tidigare sparad version från %s"
172
+
173
+ #: post-widget.php:172
174
+ #, php-format
175
+ #@ custom-post-widget
176
+ msgid "Content Block published. <a href=\"%s\">Manage Widgets</a>"
177
+ msgstr "Innehållsblocket är publicerat. <a href=\"%s\">Hantera widgets</a>"
178
+
179
+ #: post-widget.php:172
180
+ #@ custom-post-widget
181
+ msgid "Content Block published."
182
+ msgstr "Innehållsblocket är publicerat."
183
+
184
+ #: post-widget.php:173
185
+ #@ custom-post-widget
186
+ msgid "Block saved."
187
+ msgstr "Blocket är sparat."
188
+
189
+ #: post-widget.php:174
190
+ #, php-format
191
+ #@ custom-post-widget
192
+ msgid "Content Block submitted. <a href=\"%s\">Manage Widgets</a>"
193
+ msgstr "Innehållsblocket är skickat. <a href=\"%s\">Hantera widgets</a>"
194
+
195
+ #: post-widget.php:174
196
+ #@ custom-post-widget
197
+ msgid "Content Block submitted."
198
+ msgstr "Innehållsblocket är skickat."
199
+
200
+ #: post-widget.php:175
201
+ #, php-format
202
+ #@ custom-post-widget
203
+ msgid "Content Block scheduled for: <strong>%1$s</strong>."
204
+ msgstr "Innehållsblocket är schemalagt för publicering: <strong>%1$s</strong>."
205
+
206
+ #: post-widget.php:175
207
+ #@ custom-post-widget
208
+ msgid "M j, Y @ G:i"
209
+ msgstr "Y-M-J @ H:i"
210
+
211
+ #: post-widget.php:176
212
+ #, php-format
213
+ #@ custom-post-widget
214
+ msgid "Content Block draft updated. <a href=\"%s\">Manage Widgets</a>"
215
+ msgstr "Innehållsblockets utkast är uppdaterat. <a href=\"%s\">Hantera widgets</a>"
216
+
217
+ #: post-widget.php:176
218
+ #@ custom-post-widget
219
+ msgid "Content Block draft updated."
220
+ msgstr "Innehållsblockets utkast är uppdaterat."
221
+
222
+ #: post-widget.php:223
223
+ #: post-widget.php:224
224
+ #@ custom-post-widget
225
+ msgid "Add Content Block"
226
+ msgstr "Lägg till innehållsblock"
227
+
meta-box.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ function cpw_add_meta_box() {
4
+ add_meta_box(
5
+ 'cpw_sectionid',
6
+ __( 'Content Block Information', 'custom-post-widget' ),
7
+ 'cpw_meta_box',
8
+ 'content_block',
9
+ 'side'
10
+ );
11
+ }
12
+ add_action( 'add_meta_boxes', 'cpw_add_meta_box' );
13
+
14
+ function cpw_meta_box( $post ) {
15
+ wp_nonce_field( 'cpw_meta_box', 'cpw_meta_box_nonce' );
16
+ $value = get_post_meta( $post->ID, '_content_block_information', true );
17
+ echo '<textarea id="cpw_content_block_information" cols="40" rows="4" name="cpw_content_block_information" style="height: 8em; width: 100%;">' . esc_attr( $value ) . '</textarea>';
18
+ }
19
+
20
+ function cpw_save_postdata( $post_id ) {
21
+ if ( ! isset( $_POST['cpw_meta_box_nonce'] ) )
22
+ return $post_id;
23
+
24
+ $nonce = $_POST['cpw_meta_box_nonce'];
25
+
26
+ if ( ! wp_verify_nonce( $nonce, 'cpw_meta_box' ) )
27
+ return $post_id;
28
+
29
+ if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
30
+ return $post_id;
31
+
32
+ if ( 'content_block' == $_POST['post_type'] ) {
33
+ if ( ! current_user_can( 'edit_page', $post_id ) )
34
+ return $post_id;
35
+ } else {
36
+ if ( ! current_user_can( 'edit_post', $post_id ) )
37
+ return $post_id;
38
+ }
39
+
40
+ $content_block_information = sanitize_text_field( $_POST['cpw_content_block_information'] );
41
+ update_post_meta( $post_id, '_content_block_information', $content_block_information );
42
+ }
43
+ add_action( 'save_post', 'cpw_save_postdata' );
readme.txt CHANGED
@@ -5,11 +5,11 @@ 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: 3.7.1
8
- Stable tag: 2.3.5
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
12
- This plugin enables you to display the content of a custom post type called Content Block in a sidebar widget.
13
 
14
  == Description ==
15
 
@@ -17,17 +17,27 @@ The Custom Post Widget allows you to display the contents of a specific custom p
17
 
18
  Even though you could use the text widget that comes with the default WordPress install, this plugin has some major benefits:
19
 
20
- * If you are using the standard WordPress text widgets to display content on various areas of your template, this content can only be edited by users with administrator access. If you would like editors to modify the widget content, you can use this plugin to provide them access to the custom posts that provide the content for the widget areas.
21
- * The Custom Post Widget plugin enables users to use the WYSIWYG editor for editing the content and adding images.
22
- * You can even use the featured image functionality to display them in a widget.
23
- * The Custom Post Widget is compatible with the WPML Multi-Language plugin and automatically shows the correct language in the widget area.
24
- * The Content Blocks can be included in posts and pages using the built-in shortcode functionality.
25
 
26
  This plugin creates a 'content_block' custom post type. You can choose to either display the title on the page or use it to describe the contents and widget position of the content block. Note that these content blocks can only be displayed in the context of the page. I have added 'public' => false to the custom post type which means that it is not accessible outside the page context.
27
 
28
  To add content to a widget, drag it to the required position in the sidebar and select the title of the custom post in the widget configuration.
29
 
30
- This plugin is ready for localization and Dutch, French, German, Polish and Russian language files are included.
 
 
 
 
 
 
 
 
 
 
31
 
32
  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/).
33
 
@@ -41,7 +51,7 @@ You can find more information about this plugin and a screencast video which sho
41
  1. First you will have to upload the plugin to the `/wp-content/plugins/` folder.
42
  2. Then activate the plugin in the plugin panel.
43
  You will see that a new custom post type has been added called Content Block.
44
- 3. Type some content for the widget. You can choose to either use the title to describe the of the content on the page, or to display it. Check 'Show Post Title' to display the title on the page.
45
  4. Go to 'Appearance' > 'Widgets' and drag the Content Block widget to the required position in the sidebar.
46
  5. Select a Content Block from the drop-down list.
47
  6. Check the 'Show Post Title' checkbox if you would like to display the title of your Content Block
@@ -70,6 +80,10 @@ If your social media sharing plugin adds buttons to the widget areas you could c
70
 
71
  Currently the shortcode function only outputs the post content of the content block, future support for displaying the title and/or the attached featured image is being considered.
72
 
 
 
 
 
73
  = How can I embed a content block in my template file using php code? =
74
 
75
  You can use the do_shortcode function for this: `echo do_shortcode('[content_block id= ]');`
@@ -83,10 +97,13 @@ DO NOT click the 'Broken' button in the compatibility area of the plugin directo
83
 
84
  = I love your plugin! What can I do to help? =
85
 
86
- Creating and supporting this plugin takes up a lot of my free time, therefore I would highly appreciate it if you could take a couple of minutes to [write a review](http://wordpress.org/support/view/plugin-reviews/custom-post-widget). This will help other WordPress users to start using this plugin and keep me motivated to maintain and support it. Also, if you have a twitter, Facebook or Google+ account, it would be fantastic if you share the link to this plugin!
87
 
88
  == Changelog ==
89
 
 
 
 
90
  = 2.3.5 =
91
  Added the option to use your own widget template file as suggested by flynsarmy. See http://wordpress.org/support/topic/patch-custom-widget-frontends?replies=1 for more information.
92
 
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: 3.7.1
8
+ Stable tag: 2.4.1
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
12
+ This plugin enables you to edit and display Content Blocks in a sidebar widget or using a shortcode.
13
 
14
  == Description ==
15
 
17
 
18
  Even though you could use the text widget that comes with the default WordPress install, this plugin has some major benefits:
19
 
20
+ * The Custom Post Widget plugin enables users to **use the WYSIWYG editor** for editing the content and adding images.
21
+ * If you are using the standard WordPress text widgets to display content on various areas of your template, this content can only be edited by users with administrator access. If you would like **non-administrator accounts to modify the widget content**, you can use this plugin to provide them access to the custom posts that provide the content for the widget areas.
22
+ * You can even use the **featured image functionality** to display them in a widget.
23
+ * The Custom Post Widget is **compatible with the WPML** Multi-Language plugin and automatically shows the correct language in the widget area.
24
+ * The Content Blocks can be included in posts and pages using the **built-in shortcode functionality**.
25
 
26
  This plugin creates a 'content_block' custom post type. You can choose to either display the title on the page or use it to describe the contents and widget position of the content block. Note that these content blocks can only be displayed in the context of the page. I have added 'public' => false to the custom post type which means that it is not accessible outside the page context.
27
 
28
  To add content to a widget, drag it to the required position in the sidebar and select the title of the custom post in the widget configuration.
29
 
30
+ **Includes the following translations:**
31
+
32
+ * German (de_DE) by [Caspar H&uuml;binger](http://glueckpress.com/)
33
+ * French (fr_FR) by [Alexandre Simard](http://brocheafoin.biz/)
34
+ * Dutch (nl_NL) by [Johan van der Wijk](http://vanderwijk.nl)
35
+ * Polish (pl_PL) by [Kuba Skublicki](https://www.linkedin.com/in/kubecki)
36
+ * Portuguese (pt_BR) by [Ronaldo Chevalier](http://www.hostmeta.com.br/)
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 always welcome, please [contact me](http://www.vanderwijk.com/contact) to find out how you can help.
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
 
51
  1. First you will have to upload the plugin to the `/wp-content/plugins/` folder.
52
  2. Then activate the plugin in the plugin panel.
53
  You will see that a new custom post type has been added called Content Block.
54
+ 3. Type some content for the widget. You can choose to either use the title to describe the content on the page, or to display it. Check 'Show Post Title' to display the title on the page.
55
  4. Go to 'Appearance' > 'Widgets' and drag the Content Block widget to the required position in the sidebar.
56
  5. Select a Content Block from the drop-down list.
57
  6. Check the 'Show Post Title' checkbox if you would like to display the title of your Content Block
80
 
81
  Currently the shortcode function only outputs the post content of the content block, future support for displaying the title and/or the attached featured image is being considered.
82
 
83
+ = How can I make advanced changes to the widget layout? =
84
+
85
+ You can create your own widget template and upload this to your theme folder. See [this support topic](http://wordpress.org/support/topic/patch-custom-widget-frontends?replies=1) for more information about this feature.
86
+
87
  = How can I embed a content block in my template file using php code? =
88
 
89
  You can use the do_shortcode function for this: `echo do_shortcode('[content_block id= ]');`
97
 
98
  = I love your plugin! What can I do to help? =
99
 
100
+ Creating and supporting this plugin takes up a lot of my free time, therefore I would highly appreciate it if you could take a couple of minutes to [write a review](http://wordpress.org/support/view/plugin-reviews/custom-post-widget). This will help other WordPress users to start using this plugin and keep me motivated to maintain and support it. Also, if you have a twitter, Facebook or Google+ account, it would be fantastic if you could share the link to this plugin!
101
 
102
  == Changelog ==
103
 
104
+ = 2.4 =
105
+ You can now add a description to the content block to make it easier for content editors to find out where the block is displayed on the site. Thanks to Andreas Larsson the plugin now includes a Swedish translation.
106
+
107
  = 2.3.5 =
108
  Added the option to use your own widget template file as suggested by flynsarmy. See http://wordpress.org/support/topic/patch-custom-widget-frontends?replies=1 for more information.
109