Sticky Side Buttons - Version 1.0.6

Version Description

  • Support added for custom post types
Download this release

Release Info

Developer EnigmaWeb
Plugin Icon 128x128 Sticky Side Buttons
Version 1.0.6
Comparing to
See all releases

Code changes from version 1.0.5 to 1.0.6

assets/css/ssb-ui-style.css CHANGED
@@ -116,5 +116,6 @@
116
  /* Responsive */
117
  @media (max-width: 640px) {
118
  .ssb-disable-on-mobile {
 
119
  }
120
  }
116
  /* Responsive */
117
  @media (max-width: 640px) {
118
  .ssb-disable-on-mobile {
119
+ display: none;
120
  }
121
  }
readme.txt CHANGED
@@ -26,7 +26,7 @@ This simple button creator lets you create one or more floating buttons that sti
26
  * Animation style > none, slide or icons only
27
  * Disable on mobile (optional)
28
  * Customise button icons, text, link, and colors easily
29
- * Show on: Front Page, Pages, Posts (checkboxes)
30
 
31
  = Demo =
32
 
@@ -65,6 +65,9 @@ Absolutely! Please create a pull request on [GitHub here.](https://github.com/En
65
 
66
  == Changelog ==
67
 
 
 
 
68
  = 1.0.5 =
69
  * Bug fix: "page" text in footer
70
 
@@ -91,6 +94,9 @@ Absolutely! Please create a pull request on [GitHub here.](https://github.com/En
91
 
92
  == Upgrade Notice ==
93
 
 
 
 
94
  = 1.0.5 =
95
  * Bug fix: "page" text in footer
96
 
26
  * Animation style > none, slide or icons only
27
  * Disable on mobile (optional)
28
  * Customise button icons, text, link, and colors easily
29
+ * Show on: Front Page, Pages, Posts, Custom Post Types (checkboxes)
30
 
31
  = Demo =
32
 
65
 
66
  == Changelog ==
67
 
68
+ = 1.0.6 =
69
+ * Support added for custom post types
70
+
71
  = 1.0.5 =
72
  * Bug fix: "page" text in footer
73
 
94
 
95
  == Upgrade Notice ==
96
 
97
+ = 1.0.6 =
98
+ * Support added for custom post types
99
+
100
  = 1.0.5 =
101
  * Bug fix: "page" text in footer
102
 
ssb-main.php CHANGED
@@ -70,6 +70,7 @@ class ssb_main {
70
 
71
  register_setting( 'ssb_storage', 'ssb_settings' );
72
  register_setting( 'ssb_storage', 'ssb_buttons' );
 
73
 
74
  }
75
 
70
 
71
  register_setting( 'ssb_storage', 'ssb_settings' );
72
  register_setting( 'ssb_storage', 'ssb_buttons' );
73
+ register_setting('ssb_storage', 'ssb_showoncpt');
74
 
75
  }
76
 
ssb-ui.php CHANGED
@@ -15,6 +15,8 @@ class ssb_ui {
15
  public $buttons;
16
  public $settings;
17
  public $btns_order;
 
 
18
 
19
  /**
20
  * Dump everything for this class here
@@ -26,6 +28,7 @@ class ssb_ui {
26
  // Pull stored data
27
  $this->buttons = get_option( 'ssb_buttons' );
28
  $this->settings = get_option( 'ssb_settings' );
 
29
 
30
  // Buttons Sorting
31
  $this->btns_order = explode( '&', str_replace( 'sort=', '', $this->buttons['btns_order'] ) );
@@ -356,6 +359,20 @@ class ssb_ui {
356
  <?php _e( 'Posts', 'sticky-side-buttons' ); ?>
357
  </label>
358
  </p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
359
  <p>
360
  <label for="show-on-frontpage">
361
  <input type="checkbox"
@@ -391,7 +408,7 @@ class ssb_ui {
391
  // Show on
392
  if ( ( $this->settings['show_on_pages'] && get_post_type() == 'page' && ! is_front_page() ) ||
393
  ( $this->settings['show_on_posts'] && ( get_post_type() == 'post' ) ) ||
394
- ( $this->settings['show_on_frontpage'] && is_front_page() ) ) {
395
 
396
  // Buttons exists
397
  if ( isset( $this->buttons['btns'] ) ) {
15
  public $buttons;
16
  public $settings;
17
  public $btns_order;
18
+ public $cpts;
19
+ public $showoncpt;
20
 
21
  /**
22
  * Dump everything for this class here
28
  // Pull stored data
29
  $this->buttons = get_option( 'ssb_buttons' );
30
  $this->settings = get_option( 'ssb_settings' );
31
+ $this->showoncpt = get_option( 'ssb_showoncpt' );
32
 
33
  // Buttons Sorting
34
  $this->btns_order = explode( '&', str_replace( 'sort=', '', $this->buttons['btns_order'] ) );
359
  <?php _e( 'Posts', 'sticky-side-buttons' ); ?>
360
  </label>
361
  </p>
362
+ <?php $this->cpts = get_post_types( array( '_builtin' => false ), 'objects' );
363
+ if ( $this->cpts ):
364
+ foreach ( $this->cpts as $cpt ): ?>
365
+ <p>
366
+ <label for="show-on-<?php echo $cpt->name; ?>">
367
+ <input type="checkbox"
368
+ name="ssb_showoncpt[]"
369
+ id="show-on-<?php echo $cpt->name; ?>"
370
+ value="<?php echo $cpt->name; ?>"
371
+ <?php echo ( in_array( $cpt->name, $this->showoncpt ) ) ? ' checked="checked"' : ''; ?>>
372
+ <?php _e( $cpt->labels->name, 'sticky-side-buttons' ); ?>
373
+ </label>
374
+ </p>
375
+ <?php endforeach; endif; ?>
376
  <p>
377
  <label for="show-on-frontpage">
378
  <input type="checkbox"
408
  // Show on
409
  if ( ( $this->settings['show_on_pages'] && get_post_type() == 'page' && ! is_front_page() ) ||
410
  ( $this->settings['show_on_posts'] && ( get_post_type() == 'post' ) ) ||
411
+ ( $this->settings['show_on_frontpage'] && is_front_page() ) || (in_array(get_post_type(), $this->showoncpt))) {
412
 
413
  // Buttons exists
414
  if ( isset( $this->buttons['btns'] ) ) {
sticky-side-buttons.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /*
3
  Plugin Name: Sticky Side Buttons
4
- Version: 1.0.5
5
  Plugin URI: https://wordpress.org/plugins/sticky-side-buttons/
6
  Description: Flexible button creator allowing you to stick floating buttons to the side of your site.
7
  Author: Maeve Lander
@@ -35,6 +35,18 @@ function ssb_activate() {
35
 
36
  update_option( 'ssb_settings', $new_settings );
37
 
 
 
 
 
 
 
 
 
 
 
 
 
38
  }
39
 
40
  register_activation_hook( __FILE__, 'ssb_activate' );
1
  <?php
2
  /*
3
  Plugin Name: Sticky Side Buttons
4
+ Version: 1.0.6
5
  Plugin URI: https://wordpress.org/plugins/sticky-side-buttons/
6
  Description: Flexible button creator allowing you to stick floating buttons to the side of your site.
7
  Author: Maeve Lander
35
 
36
  update_option( 'ssb_settings', $new_settings );
37
 
38
+ /** @var $default_options_showoncpt intializing empty array */
39
+ $default_options_showoncpt = array();
40
+ /** @var $registered_cpts getting registered CPTs */
41
+ $registered_cpts = get_post_types(array('_builtin' => false), 'objects');
42
+ foreach ($registered_cpts as $registered_cpt){
43
+
44
+ $default_options_showoncpt[] = $registered_cpt->name;
45
+
46
+ }
47
+
48
+ update_option('ssb_showoncpt', $default_options_showoncpt);
49
+
50
  }
51
 
52
  register_activation_hook( __FILE__, 'ssb_activate' );