Content Blocks (Custom Post Widget) - Version 2.4.2

Version Description

Download this release

Release Info

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

Code changes from version 2.4.1 to 2.4.2

Files changed (2) hide show
  1. custom-post-widget.php +1 -1
  2. post-widget.php +7 -11
custom-post-widget.php CHANGED
@@ -3,7 +3,7 @@
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
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.2
7
  Author: Johan van der Wijk
8
  Author URI: http://www.vanderwijk.com
9
  License: GPL2
post-widget.php CHANGED
@@ -230,17 +230,13 @@ function add_content_block_icon() {
230
  }
231
 
232
  // Only add content_block icon above posts and pages
233
- function check_post_type_and_remove_media_buttons() {
234
  global $current_screen;
235
- if( 'content_block' != $current_screen -> post_type ) add_filter( 'media_buttons', 'add_content_block_icon' );
 
 
 
236
  }
237
- add_action( 'admin_head', 'check_post_type_and_remove_media_buttons' );
238
-
239
- require( 'popup.php' );
240
 
241
- // Only add content block popup action on page and post edit
242
- if( !defined( 'CUSTOM_POST_WIDGET_CURRENT_PAGE' ) )
243
- define( 'CUSTOM_POST_WIDGET_CURRENT_PAGE', basename( $_SERVER['PHP_SELF'] ) );
244
- if( in_array( CUSTOM_POST_WIDGET_CURRENT_PAGE, array( 'post.php', 'page.php', 'page-new.php', 'post-new.php' ) ) ) {
245
- add_action( 'admin_footer', 'add_content_block_popup' );
246
- }
230
  }
231
 
232
  // Only add content_block icon above posts and pages
233
+ function cpw_add_content_block_button() {
234
  global $current_screen;
235
+ if( 'content_block' != $current_screen -> post_type ) {
236
+ add_filter( 'media_buttons', 'add_content_block_icon' );
237
+ add_action( 'admin_footer', 'add_content_block_popup' );
238
+ }
239
  }
240
+ add_action( 'admin_head', 'cpw_add_content_block_button' );
 
 
241
 
242
+ require( 'popup.php' );