Skip to content

Commit bd3d930

Browse files
refactor: use admin_notice to add the banner anchor
1 parent 6c16051 commit bd3d930

File tree

3 files changed

+19
-14
lines changed

3 files changed

+19
-14
lines changed

css/settings.css

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,12 @@
127127

128128
.feedzy-banner-dashboard:has(.tsdk-banner-cta) {
129129
margin: 20px 0;
130+
131+
/* Remove the properties added by .notice */
132+
background: transparent;
133+
border: unset;
134+
box-shadow: unset;
135+
padding: unset;
130136
}
131137

132138
.feedzy-container{

includes/admin/feedzy-rss-feeds-admin.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ public function enqueue_styles_admin() {
130130

131131
if ( 'feedzy_imports' === $screen->post_type && 'edit' === $screen->base ) {
132132
$this->register_survey();
133+
$this->add_banner_anchor();
133134
}
134135

135136
if ( 'feedzy_categories' === $screen->post_type ) {
@@ -158,6 +159,7 @@ public function enqueue_styles_admin() {
158159
);
159160

160161
$this->register_survey();
162+
$this->add_banner_anchor();
161163
}
162164

163165
if ( 'feedzy_page_feedzy-settings' === $screen->base ) {
@@ -1724,6 +1726,16 @@ public function register_survey() {
17241726
wp_enqueue_script( $this->plugin_name . '_survey', FEEDZY_ABSURL . 'js/survey.js', array( $survey_handler ), $this->version, true );
17251727
wp_localize_script( $this->plugin_name . '_survey', 'feedzySurveyData', $this->get_survery_metadata() );
17261728

1727-
wp_enqueue_script( $this->plugin_name . '_banner', FEEDZY_ABSURL . 'js/banner.js', array(), $this->version, true );
1729+
}
1730+
1731+
/**
1732+
* Add banner anchor for promotions.
1733+
*/
1734+
public function add_banner_anchor() {
1735+
add_action(
1736+
'admin_notices', function() {
1737+
echo '<div id="tsdk_banner" class="notice feedzy-banner-dashboard"></div>';
1738+
}, 999
1739+
);
17281740
}
17291741
}

js/banner.js

Lines changed: 0 additions & 13 deletions
This file was deleted.

0 commit comments

Comments
 (0)