Skip to content

Commit 6c16051

Browse files
feat: add banner to Import Post and Feed Categories page
1 parent 2ee8fa7 commit 6c16051

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed

css/settings.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,10 @@
125125
padding: 5px;
126126
}
127127

128+
.feedzy-banner-dashboard:has(.tsdk-banner-cta) {
129+
margin: 20px 0;
130+
}
131+
128132
.feedzy-container{
129133
max-width: 1224px;
130134
margin: 0 auto;

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,13 @@ public function enqueue_styles_admin() {
179179
);
180180

181181
$this->register_survey();
182+
}
182183

184+
if (
185+
'feedzy_page_feedzy-settings' === $screen->base ||
186+
'feedzy_categories' === $screen->post_type ||
187+
( 'feedzy_imports' === $screen->post_type && 'edit' === $screen->base )
188+
) {
183189
$license_data = get_option( 'feedzy_rss_feeds_pro_license_data', array() );
184190
if ( self::plan_category( $license_data ) <= 1 ) {
185191
do_action( 'themeisle_sdk_load_banner', 'feedzy' );
@@ -1717,5 +1723,7 @@ public function register_survey() {
17171723
do_action( 'themeisle_sdk_dependency_enqueue_script', 'survey' );
17181724
wp_enqueue_script( $this->plugin_name . '_survey', FEEDZY_ABSURL . 'js/survey.js', array( $survey_handler ), $this->version, true );
17191725
wp_localize_script( $this->plugin_name . '_survey', 'feedzySurveyData', $this->get_survery_metadata() );
1726+
1727+
wp_enqueue_script( $this->plugin_name . '_banner', FEEDZY_ABSURL . 'js/banner.js', array(), $this->version, true );
17201728
}
17211729
}

js/banner.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
document.addEventListener("DOMContentLoaded", function () {
2+
const wpHeaderEnd = document.querySelector(".wp-header-end");
3+
if (!wpHeaderEnd) {
4+
return;
5+
}
6+
7+
const bannerRoot = document.createElement("div");
8+
bannerRoot.id = "tsdk_banner";
9+
bannerRoot.classList.add("feedzy-banner-dashboard");
10+
wpHeaderEnd.insertAdjacentElement("afterend", bannerRoot);
11+
12+
document.dispatchEvent(new Event("themeisle:banner:init"));
13+
});

0 commit comments

Comments
 (0)