Widgets on Pages - Version 1.2.3

Version Description

  1. Fixed issue - Conflict with some admin pages - Seen with Subscribe to Comments Reloaded
Download this release

Release Info

Developer toddhalfpenny
Plugin Icon 128x128 Widgets on Pages
Version 1.2.3
Comparing to
See all releases

Code changes from version 1.1.1 to 1.2.3

admin/class-widgets-on-pages-admin.php CHANGED
@@ -41,8 +41,8 @@ class Widgets_On_Pages_Admin
41
  * Initialize the class and set its properties.
42
  *
43
  * @since 1.0.0
44
- * @param string $plugin_name The name of this plugin.
45
- * @param string $version The version of this plugin.
46
  */
47
  public function __construct( $plugin_name, $version )
48
  {
@@ -65,7 +65,10 @@ class Widgets_On_Pages_Admin
65
  add_action( 'admin_init', array( $this, 'wop_register_settings' ) );
66
  add_action( 'widgets_init', array( $this, 'wop_register_sidebar' ) );
67
  add_action( 'admin_menu', array( $this, 'wop_remove_hidden_meta' ) );
68
- add_action( 'add_meta_boxes', array( $this, 'wop_add_custom_meta' ) );
 
 
 
69
  add_filter(
70
  'contextual_help',
71
  array( $this, 'wop_plugin_help' ),
@@ -139,7 +142,7 @@ class Widgets_On_Pages_Admin
139
  $this->plugin_name,
140
  'Turbo Sidebars',
141
  'Turbo Sidebars',
142
- 'manage_options',
143
  'edit.php?post_type=turbo-sidebar-cpt'
144
  );
145
  }
@@ -167,8 +170,8 @@ class Widgets_On_Pages_Admin
167
  /**
168
  * Render the options page for plugin
169
  *
170
- * @param string $text The old help.
171
- * @param string $screen_id Unique string id of the screen.
172
  * @param WP_Screen $screen Current WP_Screen instance.
173
  * @since 1.0.0
174
  */
@@ -195,15 +198,16 @@ class Widgets_On_Pages_Admin
195
  }
196
 
197
  /**
198
- * Adds meta boxes from admin screen
199
  *
200
  * @since 1.1.0
201
  */
202
- public function wop_add_custom_meta()
203
  {
 
204
  add_meta_box(
205
  'wop-cpt-shortcode-meta-box',
206
- 'Shortcode',
207
  array( $this, 'cpt_shortcode_meta_box_markup' ),
208
  'turbo-sidebar-cpt',
209
  'side',
@@ -212,24 +216,36 @@ class Widgets_On_Pages_Admin
212
  );
213
  }
214
 
 
 
 
 
 
 
 
 
 
215
  /**
216
  * Shortcode metabox markup
217
  *
218
- * @param object $object Our WP post.
219
  * @since 1.1.0
220
  */
221
- public function cpt_shortcode_meta_box_markup( $object )
222
  {
223
- echo __( '<p>Use this shortcode in your post/page</p>', 'widgets-on-pages' ) ;
224
- $shortcode_id = '[widgets_on_pages id="' . $object->post_title . '"]';
225
  echo '<p id="wop-shortcode">' . $shortcode_id . '</p>' ;
 
 
 
226
  }
227
 
228
  /**
229
  * Creates a new Turbo Sidebars custom post type
230
  *
231
- * @since 1.0.0
232
- * @uses register_post_type()
233
  */
234
  public static function wop_cpt_turbo_sidebars()
235
  {
@@ -253,7 +269,7 @@ class Widgets_On_Pages_Admin
253
  $opts['rewrite'] = false;
254
  $opts['show_in_admin_bar'] = false;
255
  $opts['show_in_menu'] = 'admin.php?page=widgets-on-pages';
256
- // $opts['show_in_menu'] = true;
257
  $opts['show_in_nav_menu'] = false;
258
  $opts['show_ui'] = true;
259
  $opts['supports'] = array( 'title', 'excerpt' );
@@ -306,22 +322,24 @@ class Widgets_On_Pages_Admin
306
  'post_type' => 'turbo-sidebar-cpt',
307
  'posts_per_page' => 100,
308
  );
309
- $loop = new WP_Query( $args );
310
- while ( $loop->have_posts() ) {
311
- $loop->the_post();
 
 
312
 
313
- if ( is_numeric( $loop->post->post_name ) ) {
314
- $name = 'Widgets on Pages ' . $loop->post->post_name;
315
- $shortcode_id = $loop->post->post_name;
316
- $id = 'wop-' . $loop->post->post_name;
317
  } else {
318
- $name = $loop->post->post_title;
319
- $id = 'wop-' . $loop->post->post_name;
320
- $shortcode_id = $loop->post->post_title;
321
  }
322
 
323
- if ( '' != $loop->post->post_excerpt ) {
324
- $id = 'wop-' . $loop->post->post_excerpt;
325
  }
326
  $desc = 'Widgets on Pages sidebar. Use shortcode';
327
  register_sidebar( array(
@@ -373,4 +391,4 @@ class Widgets_On_Pages_Admin
373
  {
374
  }
375
 
376
- }
41
  * Initialize the class and set its properties.
42
  *
43
  * @since 1.0.0
44
+ * @param string $plugin_name The name of this plugin.
45
+ * @param string $version The version of this plugin.
46
  */
47
  public function __construct( $plugin_name, $version )
48
  {
65
  add_action( 'admin_init', array( $this, 'wop_register_settings' ) );
66
  add_action( 'widgets_init', array( $this, 'wop_register_sidebar' ) );
67
  add_action( 'admin_menu', array( $this, 'wop_remove_hidden_meta' ) );
68
+ // Shortcode/Template Tag Custom Meta on Turbo Sidebar CTP.
69
+ add_action( 'load-post.php', function () {
70
+ add_action( 'add_meta_boxes', array( $this, 'wop_add_edit_only_custom_meta' ) );
71
+ } );
72
  add_filter(
73
  'contextual_help',
74
  array( $this, 'wop_plugin_help' ),
142
  $this->plugin_name,
143
  'Turbo Sidebars',
144
  'Turbo Sidebars',
145
+ 'edit_posts',
146
  'edit.php?post_type=turbo-sidebar-cpt'
147
  );
148
  }
170
  /**
171
  * Render the options page for plugin
172
  *
173
+ * @param string $text The old help.
174
+ * @param string $screen_id Unique string id of the screen.
175
  * @param WP_Screen $screen Current WP_Screen instance.
176
  * @since 1.0.0
177
  */
198
  }
199
 
200
  /**
201
+ * Adds meta boxes from admin screen (Shortcode and Template Tag)
202
  *
203
  * @since 1.1.0
204
  */
205
+ public function wop_add_edit_only_custom_meta()
206
  {
207
+ // Shortcode & Template Tag- for info and copying.
208
  add_meta_box(
209
  'wop-cpt-shortcode-meta-box',
210
+ __( 'Shortcode / Template Tag', 'widgets-on-pages' ),
211
  array( $this, 'cpt_shortcode_meta_box_markup' ),
212
  'turbo-sidebar-cpt',
213
  'side',
216
  );
217
  }
218
 
219
+ /**
220
+ * Adds meta boxes from admin screen
221
+ *
222
+ * @since 1.1.0
223
+ */
224
+ public function wop_add_custom_meta()
225
+ {
226
+ }
227
+
228
  /**
229
  * Shortcode metabox markup
230
  *
231
+ * @param object $post Our WP post.
232
  * @since 1.1.0
233
  */
234
+ public function cpt_shortcode_meta_box_markup( $post )
235
  {
236
+ echo __( '<h4>Shortcode</h4><p>Use this shortcode in your post/page</h4>', 'widgets-on-pages' ) ;
237
+ $shortcode_id = '[widgets_on_pages id="' . $post->post_title . '"]';
238
  echo '<p id="wop-shortcode">' . $shortcode_id . '</p>' ;
239
+ echo __( '<h4>Template Tag</h4><p>Use this code to include the sidebar in your theme.</h4>', 'widgets-on-pages' ) ;
240
+ $shortcode_id = esc_html( '<?php widgets_on_template("' . $post->post_title . '");?>' );
241
+ echo '<p id="wop-template-tag">' . $shortcode_id . '</p>' ;
242
  }
243
 
244
  /**
245
  * Creates a new Turbo Sidebars custom post type
246
  *
247
+ * @since 1.0.0
248
+ * @uses register_post_type()
249
  */
250
  public static function wop_cpt_turbo_sidebars()
251
  {
269
  $opts['rewrite'] = false;
270
  $opts['show_in_admin_bar'] = false;
271
  $opts['show_in_menu'] = 'admin.php?page=widgets-on-pages';
272
+ // $opts['show_in_menu'] = true;
273
  $opts['show_in_nav_menu'] = false;
274
  $opts['show_ui'] = true;
275
  $opts['supports'] = array( 'title', 'excerpt' );
322
  'post_type' => 'turbo-sidebar-cpt',
323
  'posts_per_page' => 100,
324
  );
325
+ // Note: not using WP_Query as can cause pages to not display (e.g. Manage
326
+ // Subscriptions link with Subscribe to Comments Reloaded - https://core.trac.wordpress.org/ticket/18408).
327
+ $myposts = get_posts( $args );
328
+ foreach ( $myposts as $post ) {
329
+ setup_postdata( $post );
330
 
331
+ if ( is_numeric( $post->post_name ) ) {
332
+ $name = 'Widgets on Pages ' . $post->post_name;
333
+ $shortcode_id = $post->post_name;
334
+ $id = 'wop-' . $post->post_name;
335
  } else {
336
+ $name = $post->post_title;
337
+ $id = 'wop-' . $post->post_name;
338
+ $shortcode_id = $post->post_title;
339
  }
340
 
341
+ if ( '' != $post->post_excerpt ) {
342
+ $id = 'wop-' . $post->post_excerpt;
343
  }
344
  $desc = 'Widgets on Pages sidebar. Use shortcode';
345
  register_sidebar( array(
391
  {
392
  }
393
 
394
+ }
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: toddhalfpenny
3
  Donate link: https://datamad.co.uk/donate/
4
  Tags: widgets, widgets in page, widgets in post, sidebar, pages, post, shortcode, inline, widgetise, widgetize, theme
5
  Requires at least: 2.8
6
- Tested up to: 4.8
7
- Stable tag: 1.1.1
8
 
9
  The easiest and highest rated way to Add Widgets or Sidebars to Posts and Pages using shortcodes or template tags.
10
 
@@ -22,7 +22,7 @@ Sidebars can be included in the post/page by using a shortcode like the followin
22
 
23
  > With the [PRO](https://datamad.co.uk/wordpress-plugins/widgets-on-pages/) version the widgets can be inserted simply with clicks-not-code using a wizard in the visual editor. This version also includes layout options to easily set the widgets in columns/grid presentation.
24
  >
25
- > The Pro version also includes support for auto-inserting widgets/sidebars into posts and/or pages, with the ability to have them appear before or after the main content.
26
 
27
  The sidebars can also be added to any theme, using template tags. This is an ace way to add widgets/sidebars to a theme's header and footer (or any other part of a theme).
28
 
@@ -32,7 +32,7 @@ https://www.youtube.com/watch?v=w2LfCihCqRI
32
 
33
  **Current Features Include**
34
 
35
- * Highest Rating - 120 5* Reviews
36
  * No Coding needed
37
  * Create unlimited sidebars
38
  * Place them in posts/pages/custom post types
@@ -41,9 +41,11 @@ https://www.youtube.com/watch?v=w2LfCihCqRI
41
 
42
  **Recent Reviews**
43
 
44
- **&#8727; &#8727; &#8727; &#8727; &#8727;** Works as advertised + timely response to support request - [3cstudio](https://wordpress.org/support/topic/works-as-advertised-timely-response-to-support-request/)
45
 
46
- **&#8727; &#8727; &#8727; &#8727; &#8727;** Saving me HOURS of work - [andynick](https://wordpress.org/support/topic/saving-me-hours-of-work/)
 
 
47
 
48
  == Installation ==
49
 
@@ -85,6 +87,29 @@ Yes... you can have an unlimited number of sidebars defined. The number availabl
85
 
86
  == Changelog ==
87
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
88
  = 1.1.1 =
89
 
90
  1. Bugfix - remove TurboSidebars from Search results
3
  Donate link: https://datamad.co.uk/donate/
4
  Tags: widgets, widgets in page, widgets in post, sidebar, pages, post, shortcode, inline, widgetise, widgetize, theme
5
  Requires at least: 2.8
6
+ Tested up to: 4.8.1
7
+ Stable tag: 1.2.3
8
 
9
  The easiest and highest rated way to Add Widgets or Sidebars to Posts and Pages using shortcodes or template tags.
10
 
22
 
23
  > With the [PRO](https://datamad.co.uk/wordpress-plugins/widgets-on-pages/) version the widgets can be inserted simply with clicks-not-code using a wizard in the visual editor. This version also includes layout options to easily set the widgets in columns/grid presentation.
24
  >
25
+ > Pro version also supports the configurable option to automatically add widgets to all your posts and/or pages. Choose the layout options and whether to add the sidebar and widgets before or after the content. Ideal for adding lists of related posts to the end of every post. Each post and page can also be individually excluded from the auto-inclsion of the widgets.
26
 
27
  The sidebars can also be added to any theme, using template tags. This is an ace way to add widgets/sidebars to a theme's header and footer (or any other part of a theme).
28
 
32
 
33
  **Current Features Include**
34
 
35
+ * Highest Rating - 122 5* Reviews
36
  * No Coding needed
37
  * Create unlimited sidebars
38
  * Place them in posts/pages/custom post types
41
 
42
  **Recent Reviews**
43
 
44
+ **&#8727; &#8727; &#8727; &#8727; &#8727;** Just purchased PRO version and well worth the money. - [@artmuns](https://wordpress.org/support/topic/extremely-useful-plugin-19/)
45
 
46
+ **&#8727; &#8727; &#8727; &#8727; &#8727;** Works as advertised + timely response to support request - [@3cstudio](https://wordpress.org/support/topic/works-as-advertised-timely-response-to-support-request/)
47
+
48
+ **&#8727; &#8727; &#8727; &#8727; &#8727;** Saving me HOURS of work - [@andynick](https://wordpress.org/support/topic/saving-me-hours-of-work/)
49
 
50
  == Installation ==
51
 
87
 
88
  == Changelog ==
89
 
90
+ = 1.2.3 =
91
+
92
+ 1. Fixed [issue](https://wordpress.org/support/topic/widgets-on-pages-partially-breaks-subscribe-to-comments-reloaded/#post-9389051) - Conflict with some admin pages - Seen with Subscribe to Comments Reloaded
93
+
94
+
95
+ = 1.2.2 =
96
+
97
+ 1. Change capability of TurboSidebars menu item to 'edit_post' to allow editor access
98
+
99
+
100
+ = 1.2.1 =
101
+
102
+ 1. Bugfix - remove TurboSidebars from Search results
103
+
104
+
105
+ = 1.2 =
106
+
107
+ 1. Pro - Add *Auto Insert* support for automatically adding Widgets into posts and page, with options for before or after content, restricting by post/page and explicitly excluding from specific posts and pages.
108
+ 1. Add nice message if trying to activate plugin when other versions may already be active
109
+ 1. Remove Turbo Sidebar shortcode-meta-box prior to 1st save.
110
+ 1. Add Template Tag to Turbo Sidebar meta box
111
+
112
+
113
  = 1.1.1 =
114
 
115
  1. Bugfix - remove TurboSidebars from Search results
widgets_on_pages.php CHANGED
@@ -11,7 +11,7 @@
11
  * Plugin Name: Widgets On Pages
12
  * Plugin URI: https://datamad.co.uk/widgets-on-pages
13
  * Description: The easiest way to Add Widgets or Sidebars to Posts and Pages using shortcodes or template tags.
14
- * Version: 1.1.1
15
  * Author: Todd Halfpenny
16
  * Author URI: http://toddhalfpenny.com/
17
  * License: GPL-2.0+
@@ -83,7 +83,7 @@ if ( !defined( 'WPINC' ) ) {
83
  die;
84
  }
85
  if ( !defined( 'WOP_PLUGIN_VERSION' ) ) {
86
- define( 'WOP_PLUGIN_VERSION', '1.1.1' );
87
  }
88
  /**
89
  * The code that runs during plugin activation.
11
  * Plugin Name: Widgets On Pages
12
  * Plugin URI: https://datamad.co.uk/widgets-on-pages
13
  * Description: The easiest way to Add Widgets or Sidebars to Posts and Pages using shortcodes or template tags.
14
+ * Version: 1.2.3
15
  * Author: Todd Halfpenny
16
  * Author URI: http://toddhalfpenny.com/
17
  * License: GPL-2.0+
83
  die;
84
  }
85
  if ( !defined( 'WOP_PLUGIN_VERSION' ) ) {
86
+ define( 'WOP_PLUGIN_VERSION', '1.2.3' );
87
  }
88
  /**
89
  * The code that runs during plugin activation.