Version Description
- Fix bug for that hid banner on pages with no id, fix some permissions issues.
Download this release
Release Info
Developer | rpetersen29 |
Plugin | Simple Banner |
Version | 2.4.3 |
Comparing to | |
See all releases |
Code changes from version 2.4.2 to 2.4.3
- readme.txt +7 -1
- simple-banner.php +11 -4
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.me/rpetersenDev
|
|
4 |
Tags: banner, banners, simple, announcement, announcements, cta, notification, bar, bars, free, hello bar, hellobar, pro
|
5 |
Requires at least: 3.0.1
|
6 |
Tested up to: 5.4.0
|
7 |
-
Stable tag: 2.4.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -96,6 +96,9 @@ This feature is being actively developed, in the meantime you can use this custo
|
|
96 |
|
97 |
== Changelog ==
|
98 |
|
|
|
|
|
|
|
99 |
= 2.4.2 =
|
100 |
* Disable header margin/padding when banner is hidden or disabled, fixed homepage disabling bug, added option to keep/remove custom css/js when disabled or hidden.
|
101 |
|
@@ -194,6 +197,9 @@ This feature is being actively developed, in the meantime you can use this custo
|
|
194 |
|
195 |
== Upgrade Notice ==
|
196 |
|
|
|
|
|
|
|
197 |
= 2.4.2 =
|
198 |
* Disable header margin/padding when banner is hidden or disabled, fixed homepage disabling bug, added option to keep/remove custom css/js when disabled or hidden.
|
199 |
|
4 |
Tags: banner, banners, simple, announcement, announcements, cta, notification, bar, bars, free, hello bar, hellobar, pro
|
5 |
Requires at least: 3.0.1
|
6 |
Tested up to: 5.4.0
|
7 |
+
Stable tag: 2.4.3
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
96 |
|
97 |
== Changelog ==
|
98 |
|
99 |
+
= 2.4.3 =
|
100 |
+
* Fix bug for that hid banner on pages with no id, fix some permissions issues.
|
101 |
+
|
102 |
= 2.4.2 =
|
103 |
* Disable header margin/padding when banner is hidden or disabled, fixed homepage disabling bug, added option to keep/remove custom css/js when disabled or hidden.
|
104 |
|
197 |
|
198 |
== Upgrade Notice ==
|
199 |
|
200 |
+
= 2.4.3 =
|
201 |
+
* Fix bug for that hid banner on pages with no id, fix some permissions issues.
|
202 |
+
*
|
203 |
= 2.4.2 =
|
204 |
* Disable header margin/padding when banner is hidden or disabled, fixed homepage disabling bug, added option to keep/remove custom css/js when disabled or hidden.
|
205 |
|
simple-banner.php
CHANGED
@@ -3,16 +3,16 @@
|
|
3 |
* Plugin Name: Simple Banner
|
4 |
* Plugin URI: https://github.com/rpetersen29/simple-banner
|
5 |
* Description: Display a simple banner at the top of your website.
|
6 |
-
* Version: 2.4.
|
7 |
* Author: Ryan Petersen
|
8 |
* Author URI: http://rpetersen29.github.io/
|
9 |
* License: GPL2
|
10 |
*
|
11 |
* @package Simple Banner
|
12 |
-
* @version 2.4.
|
13 |
* @author Ryan Petersen <rpetersen.dev@gmail.com>
|
14 |
*/
|
15 |
-
define ('VERSION', '2.4.
|
16 |
|
17 |
add_action( 'wp_enqueue_scripts', 'simple_banner' );
|
18 |
function simple_banner() {
|
@@ -53,7 +53,9 @@ function simple_banner() {
|
|
53 |
add_action( 'wp_head', 'simple_banner_custom_color');
|
54 |
function simple_banner_custom_color()
|
55 |
{
|
56 |
-
$
|
|
|
|
|
57 |
if ($banner_is_disabled){
|
58 |
echo '<style type="text/css" media="screen">.simple-banner{display:none;}</style>';
|
59 |
}
|
@@ -106,6 +108,7 @@ function simple_banner_custom_color()
|
|
106 |
add_action('admin_menu', 'simple_banner_menu');
|
107 |
function simple_banner_menu() {
|
108 |
$manage_simple_banner = 'manage_simple_banner';
|
|
|
109 |
// Add admin access
|
110 |
$admin = get_role( 'administrator' );
|
111 |
$admin->add_cap( $manage_simple_banner );
|
@@ -118,9 +121,11 @@ function simple_banner_menu() {
|
|
118 |
if (in_array($role_name, explode(",", $permissions_array))) {
|
119 |
$add_role = get_role( $role_name );
|
120 |
$add_role->add_cap( $manage_simple_banner );
|
|
|
121 |
} else {
|
122 |
$remove_role = get_role( $role_name );
|
123 |
$remove_role->remove_cap( $manage_simple_banner );
|
|
|
124 |
}
|
125 |
}
|
126 |
}
|
@@ -128,6 +133,8 @@ function simple_banner_menu() {
|
|
128 |
add_menu_page('Simple Banner Settings', 'Simple Banner', $manage_simple_banner, 'simple-banner-settings', 'simple_banner_settings_page', 'dashicons-admin-generic');
|
129 |
}
|
130 |
|
|
|
|
|
131 |
add_action( 'admin_init', 'simple_banner_settings' );
|
132 |
function simple_banner_settings() {
|
133 |
register_setting( 'simple-banner-settings-group', 'hide_simple_banner' );
|
3 |
* Plugin Name: Simple Banner
|
4 |
* Plugin URI: https://github.com/rpetersen29/simple-banner
|
5 |
* Description: Display a simple banner at the top of your website.
|
6 |
+
* Version: 2.4.3
|
7 |
* Author: Ryan Petersen
|
8 |
* Author URI: http://rpetersen29.github.io/
|
9 |
* License: GPL2
|
10 |
*
|
11 |
* @package Simple Banner
|
12 |
+
* @version 2.4.3
|
13 |
* @author Ryan Petersen <rpetersen.dev@gmail.com>
|
14 |
*/
|
15 |
+
define ('VERSION', '2.4.3');
|
16 |
|
17 |
add_action( 'wp_enqueue_scripts', 'simple_banner' );
|
18 |
function simple_banner() {
|
53 |
add_action( 'wp_head', 'simple_banner_custom_color');
|
54 |
function simple_banner_custom_color()
|
55 |
{
|
56 |
+
$disabled_pages = get_option('disabled_pages_array');
|
57 |
+
$disabled_on_current_page = !empty($disabled_pages) && in_array(get_the_ID(), explode(',', $disabled_pages));
|
58 |
+
$banner_is_disabled = $disabled_on_current_page || get_option('hide_simple_banner') == "yes";
|
59 |
if ($banner_is_disabled){
|
60 |
echo '<style type="text/css" media="screen">.simple-banner{display:none;}</style>';
|
61 |
}
|
108 |
add_action('admin_menu', 'simple_banner_menu');
|
109 |
function simple_banner_menu() {
|
110 |
$manage_simple_banner = 'manage_simple_banner';
|
111 |
+
$manage_options = 'manage_options';
|
112 |
// Add admin access
|
113 |
$admin = get_role( 'administrator' );
|
114 |
$admin->add_cap( $manage_simple_banner );
|
121 |
if (in_array($role_name, explode(",", $permissions_array))) {
|
122 |
$add_role = get_role( $role_name );
|
123 |
$add_role->add_cap( $manage_simple_banner );
|
124 |
+
$add_role->add_cap( $manage_options );
|
125 |
} else {
|
126 |
$remove_role = get_role( $role_name );
|
127 |
$remove_role->remove_cap( $manage_simple_banner );
|
128 |
+
$remove_role->remove_cap( $manage_options );
|
129 |
}
|
130 |
}
|
131 |
}
|
133 |
add_menu_page('Simple Banner Settings', 'Simple Banner', $manage_simple_banner, 'simple-banner-settings', 'simple_banner_settings_page', 'dashicons-admin-generic');
|
134 |
}
|
135 |
|
136 |
+
|
137 |
+
|
138 |
add_action( 'admin_init', 'simple_banner_settings' );
|
139 |
function simple_banner_settings() {
|
140 |
register_setting( 'simple-banner-settings-group', 'hide_simple_banner' );
|