Content Blocks (Custom Post Widget) - Version 1.9.6

Version Description

Fixed debug notices when dragging a new content block to the widget areas and removed the add content block shortcode from the content block editing screen.

Download this release

Release Info

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

Code changes from version 1.9.5 to 1.9.6

Files changed (3) hide show
  1. custom-post-widget.php +1 -1
  2. post-widget.php +13 -6
  3. readme.txt +6 -1
custom-post-widget.php CHANGED
@@ -8,7 +8,7 @@
8
  Author URI: http://www.vanderwijk.com
9
  License: GPL2
10
 
11
- Release notes: Version 1.9.5 Added option to disable content filter
12
 
13
  Copyright 2012 Johan van der Wijk (email: info@vanderwijk.com)
14
 
8
  Author URI: http://www.vanderwijk.com
9
  License: GPL2
10
 
11
+ Release notes: Version 1.9.6 Fixed all WP debug errors and removed insert content block icon from content block edit screen.
12
 
13
  Copyright 2012 Johan van der Wijk (email: info@vanderwijk.com)
14
 
post-widget.php CHANGED
@@ -8,7 +8,10 @@ class custom_post_widget extends WP_Widget {
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
  ?>
@@ -43,12 +46,12 @@ class custom_post_widget extends WP_Widget {
43
  <?php wp_reset_query(); ?>
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
  }
@@ -185,15 +188,19 @@ function custom_post_widget_shortcode($atts) {
185
  }
186
  add_shortcode('content_block', 'custom_post_widget_shortcode');
187
 
188
- // Add button above editor
189
  function add_content_block_icon($initcontext) {
190
  return $initcontext.
191
  '<a id="add_content_block" style="text-decoration:none;" class="thickbox" title="' . __("Add Content Block", 'custom-post-widget') . '" href="' . CUSTOM_POST_WIDGET_URL . 'popup.php?type=add_content_block_popup&amp;TB_inline=true&amp;inlineId=content_block_form">
192
  <img onclick="return false;" alt="' . __("Add Content Block", 'custom-post-widget') . '" src="' . CUSTOM_POST_WIDGET_URL . 'images/contentblock-13.png">
193
  </a>';
194
  }
195
-
196
- add_filter('media_buttons_context', 'add_content_block_icon');
 
 
 
 
197
 
198
  require_once( CUSTOM_POST_WIDGET_DIR . '/popup.php' );
199
 
8
  }
9
 
10
  function form( $instance ) {
11
+ $custom_post_id = ''; // initialize the variable
12
+ if (isset($instance['custom_post_id'])) {
13
+ $custom_post_id = esc_attr($instance['custom_post_id']);
14
+ };
15
  $show_custom_post_title = isset( $instance['show_custom_post_title'] ) ? $instance['show_custom_post_title'] : true;
16
  $apply_content_filters = isset( $instance['apply_content_filters'] ) ? $instance['apply_content_filters'] : true;
17
  ?>
46
  <?php wp_reset_query(); ?>
47
 
48
  <p>
49
+ <input class="checkbox" type="checkbox" <?php checked( (bool) isset( $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' ); ?>" />
50
  <label for="<?php echo $this->get_field_id( 'show_custom_post_title' ); ?>"><?php echo __( 'Show Post Title', 'custom-post-widget' ) ?></label>
51
  </p>
52
 
53
  <p>
54
+ <input class="checkbox" type="checkbox" <?php checked( (bool) isset( $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' ); ?>" />
55
  <label for="<?php echo $this->get_field_id( 'apply_content_filters' ); ?>"><?php echo __( 'Do not apply content filters', 'custom-post-widget' ) ?></label>
56
  </p> <?php
57
  }
188
  }
189
  add_shortcode('content_block', 'custom_post_widget_shortcode');
190
 
191
+ // Add button above editor if not editing content_block
192
  function add_content_block_icon($initcontext) {
193
  return $initcontext.
194
  '<a id="add_content_block" style="text-decoration:none;" class="thickbox" title="' . __("Add Content Block", 'custom-post-widget') . '" href="' . CUSTOM_POST_WIDGET_URL . 'popup.php?type=add_content_block_popup&amp;TB_inline=true&amp;inlineId=content_block_form">
195
  <img onclick="return false;" alt="' . __("Add Content Block", 'custom-post-widget') . '" src="' . CUSTOM_POST_WIDGET_URL . 'images/contentblock-13.png">
196
  </a>';
197
  }
198
+ // Only add content_block icon above posts and pages
199
+ function check_post_type_and_remove_media_buttons() {
200
+ global $current_screen;
201
+ if( 'content_block' != $current_screen->post_type ) add_filter('media_buttons_context', 'add_content_block_icon' );
202
+ }
203
+ add_action('admin_head','check_post_type_and_remove_media_buttons');
204
 
205
  require_once( CUSTOM_POST_WIDGET_DIR . '/popup.php' );
206
 
readme.txt CHANGED
@@ -79,6 +79,9 @@ If your social media sharing plugin adds buttons to the widget areas you could c
79
 
80
  == Changelog ==
81
 
 
 
 
82
  = 1.9.5 =
83
  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/).
84
 
@@ -148,4 +151,6 @@ First release
148
  == Upgrade Notice ==
149
 
150
  = 1.8 =
151
- I would appreciate some feedback on the newly introduced shortcode functionality. Is this useful or not? Any issues found? Thanks!
 
 
79
 
80
  == Changelog ==
81
 
82
+ = 1.9.6 =
83
+ Fixed debug notices when dragging a new content block to the widget areas and removed the add content block shortcode from the content block editing screen.
84
+
85
  = 1.9.5 =
86
  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/).
87
 
151
  == Upgrade Notice ==
152
 
153
  = 1.8 =
154
+ I would appreciate some feedback on the newly introduced shortcode functionality. Is this useful or not? Any issues found? Thanks!
155
+
156
+