Version Description
Added the option to disable apply_filters on the content to prevent issues with misbehaving plugins. I would have rather not added this, but it appears many plugin developers do not know how to properly use filters (see http://pippinsplugins.com/playing-nice-with-the-content-filter/).
Download this release
Release Info
Developer | vanderwijk |
Plugin | Content Blocks (Custom Post Widget) |
Version | 1.9.4 |
Comparing to | |
See all releases |
Code changes from version 1.9.3 to 1.9.4
- custom-post-widget.php +2 -2
- post-widget.php +29 -18
- readme.txt +43 -40
custom-post-widget.php
CHANGED
@@ -3,12 +3,12 @@
|
|
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.9.
|
7 |
Author: Johan van der Wijk
|
8 |
Author URI: http://www.vanderwijk.com
|
9 |
License: GPL2
|
10 |
|
11 |
-
Release notes: Version 1.9.
|
12 |
|
13 |
Copyright 2012 Johan van der Wijk (email: info@vanderwijk.com)
|
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.9.4
|
7 |
Author: Johan van der Wijk
|
8 |
Author URI: http://www.vanderwijk.com
|
9 |
License: GPL2
|
10 |
|
11 |
+
Release notes: Version 1.9.4 Added option to disable content filter
|
12 |
|
13 |
Copyright 2012 Johan van der Wijk (email: info@vanderwijk.com)
|
14 |
|
post-widget.php
CHANGED
@@ -3,28 +3,30 @@
|
|
3 |
// First create the widget for the admin panel
|
4 |
class custom_post_widget extends WP_Widget {
|
5 |
function custom_post_widget() {
|
6 |
-
$widget_ops = array('description' => __('Displays custom post content in a widget', 'custom-post-widget'));
|
7 |
-
$this->WP_Widget('custom_post_widget', __('Content Block', 'custom-post-widget'), $widget_ops);
|
8 |
}
|
9 |
|
10 |
-
function form($instance) {
|
11 |
-
$custom_post_id = esc_attr($instance['custom_post_id']);
|
12 |
-
$show_custom_post_title = isset($instance['show_custom_post_title
|
|
|
|
|
13 |
|
14 |
<p>
|
15 |
-
<label for="<?php echo $this->get_field_id('custom_post_id'); ?>"> <?php echo __('Content Block to Display:', 'custom-post-widget') ?>
|
16 |
-
<select class="widefat" id="<?php echo $this->get_field_id('custom_post_id'); ?>" name="<?php echo $this->get_field_name('custom_post_id'); ?>">
|
17 |
<?php query_posts('post_type=content_block&orderby=ID&order=ASC&showposts=-1');
|
18 |
if ( have_posts() ) : while ( have_posts() ) : the_post();
|
19 |
$currentID = get_the_ID();
|
20 |
-
if($currentID == $custom_post_id)
|
21 |
$extra = 'selected' and
|
22 |
$widgetExtraTitle = get_the_title();
|
23 |
else
|
24 |
$extra = '';
|
25 |
echo '<option value="'.$currentID.'" '.$extra.'>'.get_the_title().'</option>';
|
26 |
endwhile; else:
|
27 |
-
echo '<option value="empty">' . __('No content blocks available', 'custom-post-widget') . '</option>';
|
28 |
endif; ?>
|
29 |
</select>
|
30 |
</label>
|
@@ -34,7 +36,7 @@ class custom_post_widget extends WP_Widget {
|
|
34 |
|
35 |
<p>
|
36 |
<?php
|
37 |
-
echo '<a href="post.php?post=' . $custom_post_id . '&action=edit">' . __('Edit Content Block', 'custom-post-widget') . '</a>' ;
|
38 |
?>
|
39 |
</p>
|
40 |
|
@@ -42,14 +44,20 @@ class custom_post_widget extends WP_Widget {
|
|
42 |
|
43 |
<p>
|
44 |
<input class="checkbox" type="checkbox" <?php checked( (bool) $instance['show_custom_post_title'], true ); ?> id="<?php echo $this->get_field_id( 'show_custom_post_title' ); ?>" name="<?php echo $this->get_field_name( 'show_custom_post_title' ); ?>" />
|
45 |
-
<label for="<?php echo $this->get_field_id( 'show_custom_post_title' ); ?>"><?php echo __('Show Post Title', 'custom-post-widget') ?></label>
|
|
|
|
|
|
|
|
|
|
|
46 |
</p> <?php
|
47 |
}
|
48 |
|
49 |
-
function update($new_instance, $old_instance) {
|
50 |
$instance = $old_instance;
|
51 |
-
$instance['custom_post_id'] = strip_tags($new_instance['custom_post_id']);
|
52 |
$instance['show_custom_post_title'] = $new_instance['show_custom_post_title'];
|
|
|
53 |
return $instance;
|
54 |
}
|
55 |
|
@@ -62,9 +70,12 @@ class custom_post_widget extends WP_Widget {
|
|
62 |
}
|
63 |
// Variables from the widget settings.
|
64 |
$show_custom_post_title = isset( $instance['show_custom_post_title'] ) ? $instance['show_custom_post_title'] : false;
|
|
|
65 |
$content_post = get_post($custom_post_id);
|
66 |
$content = $content_post->post_content;
|
67 |
-
|
|
|
|
|
68 |
echo $before_widget;
|
69 |
if ( $show_custom_post_title ) {
|
70 |
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)
|
@@ -80,10 +91,10 @@ add_action('init', 'my_content_block_post_type_init');
|
|
80 |
|
81 |
function my_content_block_post_type_init() {
|
82 |
$labels = array(
|
83 |
-
'name' =>
|
84 |
-
'singular_name' =>
|
85 |
-
'plural_name' =>
|
86 |
-
'add_new' =>
|
87 |
'add_new_item' => __('Add New Content Block', 'custom-post-widget'),
|
88 |
'edit_item' => __('Edit Content Block', 'custom-post-widget'),
|
89 |
'new_item' => __('New Content Block', 'custom-post-widget'),
|
3 |
// First create the widget for the admin panel
|
4 |
class custom_post_widget extends WP_Widget {
|
5 |
function custom_post_widget() {
|
6 |
+
$widget_ops = array( 'description' => __( 'Displays custom post content in a widget', 'custom-post-widget' ) );
|
7 |
+
$this->WP_Widget( 'custom_post_widget', __( 'Content Block', 'custom-post-widget' ), $widget_ops );
|
8 |
}
|
9 |
|
10 |
+
function form( $instance ) {
|
11 |
+
$custom_post_id = esc_attr( $instance['custom_post_id'] );
|
12 |
+
$show_custom_post_title = isset( $instance['show_custom_post_title'] ) ? $instance['show_custom_post_title'] : true;
|
13 |
+
$apply_content_filters = isset( $instance['apply_content_filters'] ) ? $instance['apply_content_filters'] : true;
|
14 |
+
?>
|
15 |
|
16 |
<p>
|
17 |
+
<label for="<?php echo $this->get_field_id( 'custom_post_id' ); ?>"> <?php echo __( 'Content Block to Display:', 'custom-post-widget' ) ?>
|
18 |
+
<select class="widefat" id="<?php echo $this->get_field_id( 'custom_post_id' ); ?>" name="<?php echo $this->get_field_name( 'custom_post_id' ); ?>">
|
19 |
<?php query_posts('post_type=content_block&orderby=ID&order=ASC&showposts=-1');
|
20 |
if ( have_posts() ) : while ( have_posts() ) : the_post();
|
21 |
$currentID = get_the_ID();
|
22 |
+
if( $currentID == $custom_post_id )
|
23 |
$extra = 'selected' and
|
24 |
$widgetExtraTitle = get_the_title();
|
25 |
else
|
26 |
$extra = '';
|
27 |
echo '<option value="'.$currentID.'" '.$extra.'>'.get_the_title().'</option>';
|
28 |
endwhile; else:
|
29 |
+
echo '<option value="empty">' . __( 'No content blocks available', 'custom-post-widget' ) . '</option>';
|
30 |
endif; ?>
|
31 |
</select>
|
32 |
</label>
|
36 |
|
37 |
<p>
|
38 |
<?php
|
39 |
+
echo '<a href="post.php?post=' . $custom_post_id . '&action=edit">' . __( 'Edit Content Block', 'custom-post-widget' ) . '</a>' ;
|
40 |
?>
|
41 |
</p>
|
42 |
|
44 |
|
45 |
<p>
|
46 |
<input class="checkbox" type="checkbox" <?php checked( (bool) $instance['show_custom_post_title'], true ); ?> id="<?php echo $this->get_field_id( 'show_custom_post_title' ); ?>" name="<?php echo $this->get_field_name( 'show_custom_post_title' ); ?>" />
|
47 |
+
<label for="<?php echo $this->get_field_id( 'show_custom_post_title' ); ?>"><?php echo __( 'Show Post Title', 'custom-post-widget' ) ?></label>
|
48 |
+
</p>
|
49 |
+
|
50 |
+
<p>
|
51 |
+
<input class="checkbox" type="checkbox" <?php checked( (bool) $instance['apply_content_filters'], true ); ?> id="<?php echo $this->get_field_id( 'apply_content_filters' ); ?>" name="<?php echo $this->get_field_name( 'apply_content_filters' ); ?>" />
|
52 |
+
<label for="<?php echo $this->get_field_id( 'apply_content_filters' ); ?>"><?php echo __( 'Do not apply content filters', 'custom-post-widget' ) ?></label>
|
53 |
</p> <?php
|
54 |
}
|
55 |
|
56 |
+
function update( $new_instance, $old_instance ) {
|
57 |
$instance = $old_instance;
|
58 |
+
$instance['custom_post_id'] = strip_tags( $new_instance['custom_post_id'] );
|
59 |
$instance['show_custom_post_title'] = $new_instance['show_custom_post_title'];
|
60 |
+
$instance['apply_content_filters'] = $new_instance['apply_content_filters'];
|
61 |
return $instance;
|
62 |
}
|
63 |
|
70 |
}
|
71 |
// Variables from the widget settings.
|
72 |
$show_custom_post_title = isset( $instance['show_custom_post_title'] ) ? $instance['show_custom_post_title'] : false;
|
73 |
+
$apply_content_filters = isset($instance['apply_content_filters']) ? $instance['apply_content_filters'] : false;
|
74 |
$content_post = get_post($custom_post_id);
|
75 |
$content = $content_post->post_content;
|
76 |
+
if ( !$apply_content_filters ) { // Don't apply the content filter if checkbox selected
|
77 |
+
$content = apply_filters('the_content', $content);
|
78 |
+
}
|
79 |
echo $before_widget;
|
80 |
if ( $show_custom_post_title ) {
|
81 |
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)
|
91 |
|
92 |
function my_content_block_post_type_init() {
|
93 |
$labels = array(
|
94 |
+
'name' => _x('Content Blocks', 'post type general name', 'custom-post-widget'),
|
95 |
+
'singular_name' => _x('Content Block', 'post type singular name', 'custom-post-widget'),
|
96 |
+
'plural_name' => _x('Content Blocks', 'post type plural name', 'custom-post-widget'),
|
97 |
+
'add_new' => _x('Add Content Block', 'block', 'custom-post-widget'),
|
98 |
'add_new_item' => __('Add New Content Block', 'custom-post-widget'),
|
99 |
'edit_item' => __('Edit Content Block', 'custom-post-widget'),
|
100 |
'new_item' => __('New Content Block', 'custom-post-widget'),
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Author URI: http://www.vanderwijk.com/
|
|
4 |
Donate link: http://www.vanderwijk.com/wordpress/support/
|
5 |
Tags: custom-post, widget, sidebar, content block, content, block, custom, post, shortcode
|
6 |
Requires at least: 2.9.2
|
7 |
-
Tested up to: 3.4
|
8 |
Stable tag: 1.9.3
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
@@ -24,7 +24,7 @@ This plugin creates a 'content_block' custom post type. You can choose to either
|
|
24 |
|
25 |
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.
|
26 |
|
27 |
-
This plugin is ready for localization and Dutch, German, Polish and Russian language files are included.
|
28 |
|
29 |
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/).
|
30 |
|
@@ -73,64 +73,67 @@ add_filter('the_content', 'InsertFeaturedImage');`
|
|
73 |
|
74 |
== Changelog ==
|
75 |
|
76 |
-
= 1.
|
77 |
-
|
78 |
|
79 |
-
= 1.
|
80 |
-
|
81 |
|
82 |
-
= 1.
|
83 |
-
|
84 |
|
85 |
-
= 1.
|
86 |
-
|
|
|
87 |
|
88 |
-
= 1.
|
89 |
-
|
90 |
|
91 |
-
= 1.
|
92 |
-
|
93 |
|
94 |
-
= 1.4 =
|
95 |
-
|
|
|
96 |
|
97 |
-
= 1.
|
98 |
-
|
99 |
|
100 |
-
= 1.
|
101 |
-
|
|
|
|
|
|
|
102 |
|
103 |
= 1.7 =
|
104 |
This release fixes all the debug error messages Yoast discovered when [reviewing this plugin](http://yoast.com/wp-plugin-review/custom-post-widget/). As requested by Tony Allsopp the option of using the shortcode [content_block id= ] to pull in the content of a content block in a page or post has been added.
|
105 |
|
106 |
-
= 1.
|
107 |
-
|
108 |
|
109 |
-
= 1.
|
110 |
-
|
111 |
|
112 |
-
= 1.
|
113 |
-
The
|
114 |
|
115 |
-
= 1.
|
116 |
-
|
117 |
-
Thanks to Julian Gardner-Hobbs (http://www.hobwebs.com/) for requesting this functionality.
|
118 |
|
119 |
-
= 1.
|
120 |
-
|
121 |
|
122 |
-
= 1.
|
123 |
-
|
124 |
|
125 |
-
= 1.
|
126 |
-
|
127 |
-
Thanks to Vitaliy Kaplya (http://www.dasayt.com/) a Russian translation has been added to the plugin.
|
128 |
|
129 |
-
= 1.
|
130 |
-
|
131 |
|
132 |
-
= 1.
|
133 |
-
|
134 |
|
135 |
|
136 |
== Upgrade Notice ==
|
4 |
Donate link: http://www.vanderwijk.com/wordpress/support/
|
5 |
Tags: custom-post, widget, sidebar, content block, content, block, custom, post, shortcode
|
6 |
Requires at least: 2.9.2
|
7 |
+
Tested up to: 3.4.1
|
8 |
Stable tag: 1.9.3
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
24 |
|
25 |
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.
|
26 |
|
27 |
+
This plugin is ready for localization and Dutch, French, German, Polish and Russian language files are included.
|
28 |
|
29 |
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/).
|
30 |
|
73 |
|
74 |
== Changelog ==
|
75 |
|
76 |
+
= 1.9.4 =
|
77 |
+
Added the option to disable apply_filters on the content to prevent issues with misbehaving plugins. I would have rather not added this, but it appears many plugin developers do not know how to properly use filters (see http://pippinsplugins.com/playing-nice-with-the-content-filter/).
|
78 |
|
79 |
+
= 1.9.3 =
|
80 |
+
Minor bugfix and added the French translation which was created by Alexandre Simard (http://brocheafoin.biz/).
|
81 |
|
82 |
+
= 1.9.2 =
|
83 |
+
Now includes Polish language files as created by Kuba Skublicki.
|
84 |
|
85 |
+
= 1.9 =
|
86 |
+
The content blocks can now be translated using the WPML plugin, thanks to Jonathan Liuti (http://unboxed-logic.com/).
|
87 |
+
Thanks to Vitaliy Kaplya (http://www.dasayt.com/) a Russian translation has been added to the plugin.
|
88 |
|
89 |
+
= 1.8.6 =
|
90 |
+
Minor bugfix for edit link in widget.
|
91 |
|
92 |
+
= 1.8.5 =
|
93 |
+
This release is to fix an issue with the WordPress plugin repository.
|
94 |
|
95 |
+
= 1.8.4 =
|
96 |
+
Added edit content block link to the widget editor and changed the 'view content block' message to include a 'manage widgets' link. The 'Draft' and 'Preview' buttons are now hidden via CSS, hopefully this will soon be default WordPress behaviour (see related ticket: http://core.trac.wordpress.org/ticket/18956).
|
97 |
+
Thanks to Julian Gardner-Hobbs (http://www.hobwebs.com/) for requesting this functionality.
|
98 |
|
99 |
+
= 1.8.3 -> rolled-back because of some reported issues with social media icons being added to the widget areas =
|
100 |
+
The widget now emulates the $post loop. This means you can now make use of WordPress functionality such as inserting a [gallery]. Thanks to Jari Pennanen for providing the code.
|
101 |
|
102 |
+
= 1.8.2 =
|
103 |
+
Updated German translation and various bugfixes.
|
104 |
+
|
105 |
+
= 1.8 =
|
106 |
+
Added a button above to content editor to make it easier to add the shortcode (no need for looking up the id).
|
107 |
|
108 |
= 1.7 =
|
109 |
This release fixes all the debug error messages Yoast discovered when [reviewing this plugin](http://yoast.com/wp-plugin-review/custom-post-widget/). As requested by Tony Allsopp the option of using the shortcode [content_block id= ] to pull in the content of a content block in a page or post has been added.
|
110 |
|
111 |
+
= 1.6 =
|
112 |
+
The Custom Post Widget plugin is now using the more efficient get_post instead of query_posts to display the content block on the page. A code example for this change has been graciously provided by Paul de Wouters.
|
113 |
|
114 |
+
= 1.5 =
|
115 |
+
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.
|
116 |
|
117 |
+
= 1.4 =
|
118 |
+
The plugin has been translated into Dutch and German. Hat tip: Caspar Hübinger - glueckpress.com
|
119 |
|
120 |
+
= 1.3 =
|
121 |
+
Now the title of the content block is displayed in the admin interface to make it easy to manage the widgets.
|
|
|
122 |
|
123 |
+
= 1.2.1 =
|
124 |
+
The widget title now uses $before_title and $after_title to generate the appropriate tags to display it on the page. Hat tip: Etienne Proust.
|
125 |
|
126 |
+
= 1.2 =
|
127 |
+
Added a checkbox in the widget to make it possible to show the custom post title in the widget area
|
128 |
|
129 |
+
= 1.1.1 =
|
130 |
+
Added showposts=-1 to the post query to display more than 10 custom posts in the widget configuration select box.
|
|
|
131 |
|
132 |
+
= 1.1 =
|
133 |
+
Fixed screenshots for plugin directory
|
134 |
|
135 |
+
= 1.0 =
|
136 |
+
First release
|
137 |
|
138 |
|
139 |
== Upgrade Notice ==
|