Content Blocks (Custom Post Widget) - Version 1.5

Version Description

Thanks to Caspar Huebinger the plugin now has its own icon and as requested by Stephen James the author field has been added to the Content Block edit screen.

=

Download this release

Release Info

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

Code changes from version 1.4 to 1.5

custom-post-widget.php CHANGED
@@ -3,12 +3,14 @@
3
  Plugin Name: Custom Post Widget
4
  Plugin URI: http://www.vanderwijk.com/services/web-design/wordpress-custom-post-widget/
5
  Description: Show the content of a custom post of the type 'content_block' in a widget.
6
- Version: 1.4
7
  Author: Johan van der Wijk
8
  Author URI: http://www.vanderwijk.com
9
  License: GPL2
10
 
11
- Release notes: 1.4 Thanks to Caspar from GlückPress (http://glueckpress.com) the Custom Post Widget plugin is now fully localized.
 
 
12
 
13
  Copyright 2011 Johan van der Wijk (email: info@vanderwijk.com)
14
 
@@ -28,6 +30,7 @@
28
 
29
  /* Set constant path to the custom-post-widget plugin directory. */
30
  define( 'CUSTOM_POST_WIDGET_DIR', plugin_dir_path( __FILE__ ) );
 
31
  define( 'CUSTOM_POST_WIDGET_TEXTDOMAIN', 'custom-post-widget' );
32
 
33
  /* Launch the plugin. */
3
  Plugin Name: Custom Post Widget
4
  Plugin URI: http://www.vanderwijk.com/services/web-design/wordpress-custom-post-widget/
5
  Description: Show the content of a custom post of the type 'content_block' in a widget.
6
+ Version: 1.5
7
  Author: Johan van der Wijk
8
  Author URI: http://www.vanderwijk.com
9
  License: GPL2
10
 
11
+ Release notes: 1.5 Thanks to Caspar from GlückPress (http://glueckpress.com) the plugin
12
+ now has its own icon and as requested by Stephen James the author field has been added
13
+ to the Content Block edit screen.
14
 
15
  Copyright 2011 Johan van der Wijk (email: info@vanderwijk.com)
16
 
30
 
31
  /* Set constant path to the custom-post-widget plugin directory. */
32
  define( 'CUSTOM_POST_WIDGET_DIR', plugin_dir_path( __FILE__ ) );
33
+ define( 'CUSTOM_POST_WIDGET_URL', WP_PLUGIN_URL.'/'.str_replace(basename( __FILE__),'',plugin_basename(__FILE__)) );
34
  define( 'CUSTOM_POST_WIDGET_TEXTDOMAIN', 'custom-post-widget' );
35
 
36
  /* Launch the plugin. */
images/contentblock-32.png ADDED
Binary file
images/contentblock.png ADDED
Binary file
languages/custom-post-widget-xx_XX.pot DELETED
@@ -1 +0,0 @@
1
- MIME-Version: 1.0\nContent-Type: text/plain; charset=UTF-8\nContent-Transfer-Encoding: 8bit
 
languages/custom-post-widget.pot ADDED
@@ -0,0 +1,157 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (C) 2010 Custom Post Widget
2
+ # This file is distributed under the same license as the Custom Post Widget package.
3
+ msgid ""
4
+ msgstr ""
5
+ "Project-Id-Version: Custom Post Widget 1.4\n"
6
+ "Report-Msgid-Bugs-To: http://wordpress.org/tag/custom-post-widget\n"
7
+ "POT-Creation-Date: 2011-02-25 20:06:24+00:00\n"
8
+ "MIME-Version: 1.0\n"
9
+ "Content-Type: text/plain; charset=UTF-8\n"
10
+ "Content-Transfer-Encoding: 8bit\n"
11
+ "PO-Revision-Date: 2010-MO-DA HO:MI+ZONE\n"
12
+ "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13
+ "Language-Team: LANGUAGE <LL@li.org>\n"
14
+
15
+ #: post-widget.php:8
16
+ msgid "Displays custom post content in a widget"
17
+ msgstr ""
18
+
19
+ #: post-widget.php:9
20
+ msgid "Content Block"
21
+ msgstr ""
22
+
23
+ #: post-widget.php:19
24
+ msgid "Content Block to Display:"
25
+ msgstr ""
26
+
27
+ #: post-widget.php:31
28
+ msgid "No content blocks available"
29
+ msgstr ""
30
+
31
+ #: post-widget.php:42
32
+ msgid "Show Post Title"
33
+ msgstr ""
34
+
35
+ #: post-widget.php:61
36
+ msgid "Find"
37
+ msgstr ""
38
+
39
+ #: post-widget.php:91
40
+ msgctxt "post type general name"
41
+ msgid "Content Blocks"
42
+ msgstr ""
43
+
44
+ #: post-widget.php:92
45
+ msgctxt "post type singular name"
46
+ msgid "Content Block"
47
+ msgstr ""
48
+
49
+ #: post-widget.php:93
50
+ msgctxt "post type plural name"
51
+ msgid "Content Blocks"
52
+ msgstr ""
53
+
54
+ #: post-widget.php:94
55
+ msgctxt "block"
56
+ msgid "Add Content Block"
57
+ msgstr ""
58
+
59
+ #: post-widget.php:95
60
+ msgid "Add New Content Block"
61
+ msgstr ""
62
+
63
+ #: post-widget.php:96
64
+ msgid "Edit Content Block"
65
+ msgstr ""
66
+
67
+ #: post-widget.php:97
68
+ msgid "New Content Block"
69
+ msgstr ""
70
+
71
+ #: post-widget.php:98
72
+ msgid "View Content Block"
73
+ msgstr ""
74
+
75
+ #: post-widget.php:99
76
+ msgid "Search Content Blocks"
77
+ msgstr ""
78
+
79
+ #: post-widget.php:100
80
+ msgid "No Content Blocks Found"
81
+ msgstr ""
82
+
83
+ #: post-widget.php:101
84
+ msgid "No Content Blocks found in Trash"
85
+ msgstr ""
86
+
87
+ #: post-widget.php:126
88
+ msgid "Content Block updated. <a href=\"%s\">View Content Block</a>"
89
+ msgstr ""
90
+
91
+ #: post-widget.php:127
92
+ msgid "Custom field updated."
93
+ msgstr ""
94
+
95
+ #: post-widget.php:128
96
+ msgid "Custom field deleted."
97
+ msgstr ""
98
+
99
+ #: post-widget.php:129
100
+ msgid "Content Block updated."
101
+ msgstr ""
102
+
103
+ #: post-widget.php:130
104
+ msgid "Content Block restored to revision from %s"
105
+ msgstr ""
106
+
107
+ #: post-widget.php:131
108
+ msgid "Content Block published. <a href=\"%s\">View Content Block</a>"
109
+ msgstr ""
110
+
111
+ #: post-widget.php:132
112
+ msgid "Block saved."
113
+ msgstr ""
114
+
115
+ #: post-widget.php:133
116
+ msgid ""
117
+ "Content Block submitted. <a target=\"_blank\" href=\"%s\">Preview Content "
118
+ "Block</a>"
119
+ msgstr ""
120
+
121
+ #: post-widget.php:134
122
+ msgid ""
123
+ "Content Block scheduled for: <strong>%1$s</strong>. <a target=\"_blank\" "
124
+ "href=\"%2$s\">Preview block</a>"
125
+ msgstr ""
126
+
127
+ #: post-widget.php:135
128
+ msgid "M j, Y @ G:i"
129
+ msgstr ""
130
+
131
+ #: post-widget.php:136
132
+ msgid ""
133
+ "Content Block draft updated. <a target=\"_blank\" href=\"%s\">Preview "
134
+ "Content Block</a>"
135
+ msgstr ""
136
+
137
+ #. Plugin Name of the plugin/theme
138
+ msgid "Custom Post Widget"
139
+ msgstr ""
140
+
141
+ #. Plugin URI of the plugin/theme
142
+ msgid ""
143
+ "http://www.vanderwijk.com/services/web-design/wordpress-custom-post-widget/"
144
+ msgstr ""
145
+
146
+ #. Description of the plugin/theme
147
+ msgid ""
148
+ "Show the content of a custom post of the type 'content_block' in a widget."
149
+ msgstr ""
150
+
151
+ #. Author of the plugin/theme
152
+ msgid "Johan van der Wijk"
153
+ msgstr ""
154
+
155
+ #. Author URI of the plugin/theme
156
+ msgid "http://www.vanderwijk.com"
157
+ msgstr ""
post-widget.php CHANGED
@@ -112,10 +112,29 @@ add_action('init', 'my_content_block_post_type_init');
112
  'capability_type' => 'post',
113
  'hierarchical' => false,
114
  'menu_position' => null,
115
- 'supports' => array('title','editor','revisions','thumbnail')
116
  );
117
  register_post_type('content_block',$options);
118
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
119
 
120
  add_filter('post_updated_messages', 'content_block_messages');
121
 
112
  'capability_type' => 'post',
113
  'hierarchical' => false,
114
  'menu_position' => null,
115
+ 'supports' => array('title','editor','revisions','thumbnail','author')
116
  );
117
  register_post_type('content_block',$options);
118
  }
119
+
120
+
121
+ // Add custom styles to admin screen and menu
122
+
123
+ add_action('admin_head', 'content_block_header');
124
+
125
+ function content_block_header() {
126
+
127
+ global $post_type; ?>
128
+
129
+ <style type="text/css"><!--
130
+ <?php if (($post_type == 'content_block')) : ?>
131
+ #icon-edit { background:transparent url('<?php echo CUSTOM_POST_WIDGET_URL; ?>images/contentblock-32.png') no-repeat 0 0 !important; }
132
+ <?php endif; ?>
133
+ #adminmenu #menu-posts-contentblock div.wp-menu-image{background:transparent url('<?php echo CUSTOM_POST_WIDGET_URL;?>images/contentblock.png') no-repeat center -32px;}
134
+ #adminmenu #menu-posts-contentblock:hover div.wp-menu-image,#adminmenu #menu-posts-contentblock.wp-has-current-submenu div.wp-menu-image{background:transparent url('<?php echo CUSTOM_POST_WIDGET_URL;?>images/contentblock.png') no-repeat center 0px;}
135
+ --></style><?php
136
+
137
+ }
138
 
139
  add_filter('post_updated_messages', 'content_block_messages');
140
 
readme.txt CHANGED
@@ -5,7 +5,7 @@ Donate link: http://www.vanderwijk.com/wordpress/support/
5
  Tags: custom-post, widget, sidebar
6
  Requires at least: 2.9.2
7
  Tested up to: 3.1
8
- Stable tag: 1.4
9
 
10
  This plugin enables you to display the content of a custom post type called Content Block in a sidebar widget.
11
 
@@ -49,6 +49,24 @@ Of course you can always use the default text widget, but if you prefer to use t
49
 
50
  It is recommended to install the Widget Logic plugin, this will give you complete flexibility on widget placement.
51
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
52
  == Changelog ==
53
 
54
  = 1.0 =
@@ -72,8 +90,14 @@ Now the title of the content block is displayed in the admin interface to make i
72
  = 1.4 =
73
  The plugin has been translated into Dutch and German. Hat tip: Caspar H&uuml;binger - glueckpress.com
74
 
 
 
 
 
75
 
76
  == Upgrade Notice ==
77
 
78
  = 1.1.1 =
79
- Now supports more than 10 custom posts in the select box. Note that after upgrading you might have to save the widget state before the correct posts are being displayed.
 
 
5
  Tags: custom-post, widget, sidebar
6
  Requires at least: 2.9.2
7
  Tested up to: 3.1
8
+ Stable tag: 1.5
9
 
10
  This plugin enables you to display the content of a custom post type called Content Block in a sidebar widget.
11
 
49
 
50
  It is recommended to install the Widget Logic plugin, this will give you complete flexibility on widget placement.
51
 
52
+ = How can I display the featured image in the widget? =
53
+
54
+ This plugin has built-in support for the featured image functionality on the edit screen. But to display the image you will have to add the following code to your functions.php:
55
+
56
+ `function InsertFeaturedImage($content) {
57
+ global $post;
58
+ $original_content = $content;
59
+ if (current_theme_supports('post-thumbnails')) {
60
+ if ('content_block' == get_post_type()) {
61
+ $content = the_post_thumbnail('medium');
62
+ $content .= $original_content;
63
+ }
64
+ }
65
+ return $content;
66
+ }
67
+ add_filter('the_content', 'InsertFeaturedImage');`
68
+
69
+
70
  == Changelog ==
71
 
72
  = 1.0 =
90
  = 1.4 =
91
  The plugin has been translated into Dutch and German. Hat tip: Caspar H&uuml;binger - glueckpress.com
92
 
93
+ = 1.5 =
94
+ Thanks to Caspar Huebinger the plugin
95
+ now has its own icon and as requested by Stephen James the author field has been added to the Content Block edit screen.
96
+
97
 
98
  == Upgrade Notice ==
99
 
100
  = 1.1.1 =
101
+ Now supports more than 10 custom posts in the select box. Note that after upgrading you might have to save the widget state before the correct posts are being displayed.
102
+
103
+