Widgets on Pages - Version 1.0.3

Version Description

  1. Fixed issue with "Settings" link appearing next to each plugin.
  2. Added link to the Turbo Sidebars from the old Settings page, as per this forum post, great idea.
Download this release

Release Info

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

Code changes from version 1.0.2 to 1.0.3

admin/class-widgets-on-pages-admin.php CHANGED
@@ -51,7 +51,7 @@ class Widgets_On_Pages_Admin {
51
  $this->plugin_name = $plugin_name;
52
  $this->version = $version;
53
 
54
- add_filter( 'plugin_action_links', array( $this, 'wop_plugin_action_links' ), 10, 2 );
55
  add_filter( 'plugin_row_meta', array( $this, 'wop_register_plugins_links' ), 10, 2 );
56
 
57
  add_action( 'admin_menu', array( $this, 'wop_add_options_page' ) );
@@ -200,8 +200,7 @@ class Widgets_On_Pages_Admin {
200
  // $opts['show_in_menu'] = true;
201
  $opts['show_in_nav_menu'] = false;
202
  $opts['show_ui'] = true;
203
- $opts['supports'] = array( 'title',
204
- 'excerpt' );
205
  $opts['taxonomies'] = array();
206
  $opts['capabilities']['delete_others_posts'] = "delete_others_{$cap_type}s";
207
  $opts['capabilities']['delete_post'] = "delete_{$cap_type}";
@@ -253,20 +252,20 @@ class Widgets_On_Pages_Admin {
253
  $loop = new WP_Query( $args );
254
  while ( $loop->have_posts() ) {
255
  $loop->the_post();
256
- if (is_numeric($loop->post->post_name)) {
257
- $name = 'Widgets on Pages ' . $loop->post->post_name;
258
- $shortcode_id = $loop->post->post_name;
259
  $id = 'wop-' . $loop->post->post_name;
260
- } else {
261
- $name = $loop->post->post_title;
262
  $id = 'wop-' . $loop->post->post_name;
263
- $shortcode_id = $loop->post->post_title;
264
- }
265
- if ( '' != get_the_excerpt($loop->post) ) {
266
- $id = 'wop-' . get_the_excerpt($loop->post) ;
267
- }
268
  $desc = 'Widgets on Pages sidebar. Use shortcode';
269
- register_sidebar(array(
270
  'name' => $name,
271
  'id' => $id,
272
  'description' => __( $desc, 'widgets-on-pages' ) . ' [widgets_on_pages id="' . $shortcode_id .'"]',
51
  $this->plugin_name = $plugin_name;
52
  $this->version = $version;
53
 
54
+ add_filter( 'plugin_action_links' . plugin_basename( __FILE__ ), array( $this, 'wop_plugin_action_links' ), 10, 2 );
55
  add_filter( 'plugin_row_meta', array( $this, 'wop_register_plugins_links' ), 10, 2 );
56
 
57
  add_action( 'admin_menu', array( $this, 'wop_add_options_page' ) );
200
  // $opts['show_in_menu'] = true;
201
  $opts['show_in_nav_menu'] = false;
202
  $opts['show_ui'] = true;
203
+ $opts['supports'] = array( 'title', 'excerpt' );
 
204
  $opts['taxonomies'] = array();
205
  $opts['capabilities']['delete_others_posts'] = "delete_others_{$cap_type}s";
206
  $opts['capabilities']['delete_post'] = "delete_{$cap_type}";
252
  $loop = new WP_Query( $args );
253
  while ( $loop->have_posts() ) {
254
  $loop->the_post();
255
+ if ( is_numeric( $loop->post->post_name ) ) {
256
+ $name = 'Widgets on Pages ' . $loop->post->post_name;
257
+ $shortcode_id = $loop->post->post_name;
258
  $id = 'wop-' . $loop->post->post_name;
259
+ } else {
260
+ $name = $loop->post->post_title;
261
  $id = 'wop-' . $loop->post->post_name;
262
+ $shortcode_id = $loop->post->post_title;
263
+ }
264
+ if ( '' != get_the_excerpt( $loop->post ) ) {
265
+ $id = 'wop-' . get_the_excerpt( $loop->post );
266
+ }
267
  $desc = 'Widgets on Pages sidebar. Use shortcode';
268
+ register_sidebar( array(
269
  'name' => $name,
270
  'id' => $id,
271
  'description' => __( $desc, 'widgets-on-pages' ) . ' [widgets_on_pages id="' . $shortcode_id .'"]',
admin/partials/widgets-on-pages-admin-display.php CHANGED
@@ -45,6 +45,10 @@
45
  </td></tr>
46
  <tr><td></td>
47
  <td><input type="hidden" name="action" value="update" /></td></tr>
 
 
 
 
48
  <tr><td colspan='2'><h3>Rate this plugin</h3><p><a href="http://wordpress.org/support/view/plugin-reviews/widgets-on-pages?rate=5#postform" title="Rate me">If you like me, please rate me</a>... or maybe even <a href="http://datamad.co.uk/donate/" title="Show you love">donate to the author</a>... <p><p>or perhaps just spread the good word <a href="https://twitter.com/share" class="twitter-share-button" data-url="http://wordpress.org/extend/plugins/widgets-on-pages/" data-text="Using the Widgets on Pages WordPress plugin and lovin' it" data-via="toddhalfpenny" data-count="none">Tweet</a>
49
  </p></p></p></td></tr></table>
50
  <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script></p></td></tr>
45
  </td></tr>
46
  <tr><td></td>
47
  <td><input type="hidden" name="action" value="update" /></td></tr>
48
+ <tr><td colspan="2">
49
+ <h3>Additional Sidebars</h3>
50
+ <p><strong>Note:</strong> Additional sidebars are now managed under the <a href="<?php echo admin_url( 'edit.php?post_type=turbo-sidebar-cpt' ); ?>">Turbo Sidebars menu item</a>.</p>
51
+ </td></tr>
52
  <tr><td colspan='2'><h3>Rate this plugin</h3><p><a href="http://wordpress.org/support/view/plugin-reviews/widgets-on-pages?rate=5#postform" title="Rate me">If you like me, please rate me</a>... or maybe even <a href="http://datamad.co.uk/donate/" title="Show you love">donate to the author</a>... <p><p>or perhaps just spread the good word <a href="https://twitter.com/share" class="twitter-share-button" data-url="http://wordpress.org/extend/plugins/widgets-on-pages/" data-text="Using the Widgets on Pages WordPress plugin and lovin' it" data-via="toddhalfpenny" data-count="none">Tweet</a>
53
  </p></p></p></td></tr></table>
54
  <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script></p></td></tr>
includes/class-widgets-on-pages-activator.php CHANGED
@@ -27,11 +27,11 @@ class Widgets_On_Pages_Activator {
27
  * Long Description.
28
  *
29
  * @since 1.0.0
 
30
  */
31
- public static function activate() {
32
  require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-widgets-on-pages-admin.php';
33
-
34
- flush_rewrite_rules();
35
 
36
  // First upgrade from pre v1 release check.
37
  // Read our CPTs, to see if they've already been created.
@@ -81,5 +81,7 @@ class Widgets_On_Pages_Activator {
81
  } // End for
82
  } // End $num_sidebar check
83
  }
 
 
84
  }
85
  }
27
  * Long Description.
28
  *
29
  * @since 1.0.0
30
+ * @param strgin $wop_plugin_version Version of our plugin.
31
  */
32
+ public static function activate( $wop_plugin_version ) {
33
  require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-widgets-on-pages-admin.php';
34
+ // flush_rewrite_rules();
 
35
 
36
  // First upgrade from pre v1 release check.
37
  // Read our CPTs, to see if they've already been created.
81
  } // End for
82
  } // End $num_sidebar check
83
  }
84
+
85
+ update_option( 'wop_plugin_version', $wop_plugin_version );
86
  }
87
  }
includes/class-widgets-on-pages-deactivator.php CHANGED
@@ -26,9 +26,9 @@ class Widgets_On_Pages_Deactivator {
26
  *
27
  * Long Description.
28
  *
29
- * @since 1.0.0
30
  */
31
  public static function deactivate() {
32
-
33
  }
34
  }
26
  *
27
  * Long Description.
28
  *
29
+ * @since 1.0.3
30
  */
31
  public static function deactivate() {
32
+ delete_option( 'wop_plugin_version' );
33
  }
34
  }
includes/class-widgets-on-pages.php CHANGED
@@ -63,12 +63,13 @@ class Widgets_On_Pages {
63
  * Load the dependencies, define the locale, and set the hooks for the admin area and
64
  * the public-facing side of the site.
65
  *
66
- * @since 1.0.0
 
67
  */
68
- public function __construct() {
69
 
70
  $this->plugin_name = 'widgets-on-pages';
71
- $this->version = '1.0.0';
72
 
73
  $this->load_dependencies();
74
  $this->set_locale();
63
  * Load the dependencies, define the locale, and set the hooks for the admin area and
64
  * the public-facing side of the site.
65
  *
66
+ * @since 1.0.3
67
+ * @param strgin $wop_plugin_version Version of our plugin.
68
  */
69
+ public function __construct( $wop_plugin_version ) {
70
 
71
  $this->plugin_name = 'widgets-on-pages';
72
+ $this->version = $wop_plugin_version;
73
 
74
  $this->load_dependencies();
75
  $this->set_locale();
readme.txt CHANGED
@@ -3,32 +3,28 @@ 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
5
  Requires at least: 2.8
6
- Tested up to: 4.7.3
7
- Stable tag: 0.0.12
8
 
9
  The easiest and highest rated way to Add Widgets or Sidebars to Posts and Pages using shortcodes or template tags.
10
 
11
  == Description ==
12
 
13
- The easiest, and highest rated way to Add Widgets to Posts and/or Pages. Allows 'in-page' widget areas so widgets can be defined via shortcut straight into page/post content.
14
 
15
- There is one default widget area that can be used or you can add more from the settings menu. You can currently have an unlimited number of sidebars.
16
 
17
- Each sidebar can be called indepentenly by a shortcode and you can call more than one per post/page.
18
 
19
- Sidebars can be included in the post/page by using a shortcode like the following, where `x` is the number of the sidebar.
20
 
21
  `[widgets_on_pages id=x]`
22
 
23
- Sidebars can also be named via the Widgets on Pages options page and that name can be used instead of the `x` id.
24
-
25
 
26
 
27
  == Installation ==
28
 
29
-
30
- **NOTE** Apologies but you may lose the widgets in your customised sidebars if upgrading from pre 0.0.8 version. The cause of this loss is required to enhance functionality and reduce further possible loss of config when changing/modifying themes. The choice to to do this was not easy but hopefully will make the plugin more stable going forward.
31
-
32
  1. Install the plugin from within the Dashboard or upload the directory `widgets-on-pages` and all its contents to the `/wp-content/plugins/` directory
33
  1. Activate the plugin through the 'Plugins' menu in WordPress
34
  1. Add the widgets you want to the `Widgets on Pages` widget area in the admin screens
@@ -52,6 +48,12 @@ Your theme's CSS is probably overriding your setting... you could try using your
52
 
53
  Yes... you can have an unlimited number of sidebars defined. The number available can be administered via the settings menu.
54
 
 
 
 
 
 
 
55
  == Screenshots ==
56
 
57
  1. Setting up the sidebars.
@@ -61,6 +63,11 @@ Yes... you can have an unlimited number of sidebars defined. The number availabl
61
 
62
  == Changelog ==
63
 
 
 
 
 
 
64
  = 1.0.2 =
65
  1. Fixed issue headers being sent from template tag function.
66
 
3
  Donate link: https://datamad.co.uk/donate/
4
  Tags: widgets, widgets in page, widgets in post, sidebar, pages, post, shortcode, inline, widgetise, widgetize
5
  Requires at least: 2.8
6
+ Tested up to: 4.7.4
7
+ Stable tag: 1.0.3
8
 
9
  The easiest and highest rated way to Add Widgets or Sidebars to Posts and Pages using shortcodes or template tags.
10
 
11
  == Description ==
12
 
13
+ The easiest, and highest rated way to Add Widgets to Posts and/or Pages. Create unlimited dynamic sidebars (widget areas) and insert these into a WordPress post or page.
14
 
15
+ There is one default widget area that can be used or you can add more from the settings menu. You can have an unlimited number of sidebars, and these can be used multiple times.
16
 
17
+ Each sidebar can be called indepentenly by a shortcode and you can call more than one per post/page.
18
 
19
+ Sidebars can be included in the post/page by using a shortcode like the following, where `x` is the name of the sidebar.
20
 
21
  `[widgets_on_pages id=x]`
22
 
23
+ The sidebars can also be added to any theme, using template tags. This is an ace way to add widgets to a theme's header and footer.
 
24
 
25
 
26
  == Installation ==
27
 
 
 
 
28
  1. Install the plugin from within the Dashboard or upload the directory `widgets-on-pages` and all its contents to the `/wp-content/plugins/` directory
29
  1. Activate the plugin through the 'Plugins' menu in WordPress
30
  1. Add the widgets you want to the `Widgets on Pages` widget area in the admin screens
48
 
49
  Yes... you can have an unlimited number of sidebars defined. The number available can be administered via the settings menu.
50
 
51
+ = What widgets are supported? =
52
+
53
+ All of them. Yup, We've not come across a single non-working one yet.
54
+
55
+ Yes... you can have an unlimited number of sidebars defined. The number available can be administered via the settings menu.
56
+
57
  == Screenshots ==
58
 
59
  1. Setting up the sidebars.
63
 
64
  == Changelog ==
65
 
66
+ = 1.0.3 =
67
+ 1. Fixed [issue](https://wordpress.org/support/topic/settings-button-in-all-of-the-plugins/#post-8980118) with "Settings" link appearing next to each plugin.
68
+ 1. Added link to the Turbo Sidebars from the old Settings page, as per [this forum post](https://wordpress.org/support/topic/all-widgets-gone-cant-create-new-ones/), great idea.
69
+
70
+
71
  = 1.0.2 =
72
  1. Fixed issue headers being sent from template tag function.
73
 
widgets_on_pages.php CHANGED
@@ -10,7 +10,7 @@
10
  * Plugin Name: Widgets On Pages
11
  * Plugin URI: https://datamad.co.uk/widgets-on-pages
12
  * Description: The easiest way to Add Widgets or Sidebars to Posts and Pages using shortcodes or template tags.
13
- * Version: 1.0.2
14
  * Author: Todd Halfpenny
15
  * Author URI: http://toddhalfpenny.com/
16
  * License: GPL-2.0+
@@ -24,13 +24,19 @@ if ( ! defined( 'WPINC' ) ) {
24
  die;
25
  }
26
 
 
 
 
 
27
  /**
28
  * The code that runs during plugin activation.
29
  * This action is documented in includes/class-widgets-on-pages-activator.php
 
 
30
  */
31
- function activate_widgets_on_pages() {
32
  require_once plugin_dir_path( __FILE__ ) . 'includes/class-widgets-on-pages-activator.php';
33
- Widgets_On_Pages_Activator::activate();
34
  }
35
 
36
  /**
@@ -45,6 +51,17 @@ function deactivate_widgets_on_pages() {
45
  register_activation_hook( __FILE__, 'activate_widgets_on_pages' );
46
  register_deactivation_hook( __FILE__, 'deactivate_widgets_on_pages' );
47
 
 
 
 
 
 
 
 
 
 
 
 
48
  /**
49
  * The core plugin class that is used to define internationalization,
50
  * admin-specific hooks, and public-facing site hooks.
@@ -62,7 +79,7 @@ require plugin_dir_path( __FILE__ ) . 'includes/class-widgets-on-pages.php';
62
  */
63
  function run_widgets_on_pages() {
64
 
65
- $plugin = new Widgets_On_Pages();
66
  $plugin->run();
67
 
68
  }
10
  * Plugin Name: Widgets On Pages
11
  * Plugin URI: https://datamad.co.uk/widgets-on-pages
12
  * Description: The easiest way to Add Widgets or Sidebars to Posts and Pages using shortcodes or template tags.
13
+ * Version: 1.0.3
14
  * Author: Todd Halfpenny
15
  * Author URI: http://toddhalfpenny.com/
16
  * License: GPL-2.0+
24
  die;
25
  }
26
 
27
+ if ( ! defined( 'WOP_PLUGIN_VERSION' ) ) {
28
+ define( 'WOP_PLUGIN_VERSION', '1.0.3' );
29
+ }
30
+
31
  /**
32
  * The code that runs during plugin activation.
33
  * This action is documented in includes/class-widgets-on-pages-activator.php
34
+ *
35
+ * @param strgin $wop_plugin_version Version of our plugin.
36
  */
37
+ function activate_widgets_on_pages( $wop_plugin_version ) {
38
  require_once plugin_dir_path( __FILE__ ) . 'includes/class-widgets-on-pages-activator.php';
39
+ Widgets_On_Pages_Activator::activate( $wop_plugin_version );
40
  }
41
 
42
  /**
51
  register_activation_hook( __FILE__, 'activate_widgets_on_pages' );
52
  register_deactivation_hook( __FILE__, 'deactivate_widgets_on_pages' );
53
 
54
+ /**
55
+ * Also check if we have updated - note activation hook not fired upon updates
56
+ */
57
+ function wop_plugin_check_version() {
58
+ if ( WOP_PLUGIN_VERSION !== get_option( 'wop_plugin_version' ) ) {
59
+ activate_widgets_on_pages( WOP_PLUGIN_VERSION );
60
+ }
61
+ }
62
+
63
+ add_action( 'plugins_loaded', 'wop_plugin_check_version' );
64
+
65
  /**
66
  * The core plugin class that is used to define internationalization,
67
  * admin-specific hooks, and public-facing site hooks.
79
  */
80
  function run_widgets_on_pages() {
81
 
82
+ $plugin = new Widgets_On_Pages( WOP_PLUGIN_VERSION );
83
  $plugin->run();
84
 
85
  }