Fix: Add proper tab content padding and fix Theme tab loading issues

This commit is contained in:
Marcus Quinn
2025-03-24 17:30:23 +00:00
parent 4fe9d45eba
commit ddd2846171
2 changed files with 17 additions and 12 deletions

View File

@ -137,6 +137,11 @@ input:checked + .wp-toggle-slider:before {
transform: translateX(16px); transform: translateX(16px);
} }
/* Tab Content Area */
.wp-allstars-tab-content {
padding-top: 20px;
}
/* Base Setting Styles (Shared between simple and expandable) */ /* Base Setting Styles (Shared between simple and expandable) */
.wp-setting-base, .wp-setting-base,
.wp-setting-row, .wp-setting-row,

View File

@ -70,16 +70,13 @@ class WP_Allstars_Theme_Manager {
private static function get_theme_scripts() { private static function get_theme_scripts() {
return ' return '
jQuery(document).ready(function($) { jQuery(document).ready(function($) {
if ($("#wpa-theme-list").length && $("#wpa-theme-list").is(":empty")) { if ($("#wpa-theme-list").length) {
var $container = $("#wpa-theme-list"); var $container = $("#wpa-theme-list");
var $loadingOverlay = $("<div class=\"wp-allstars-loading-overlay\"><span class=\"spinner is-active\"></span></div>"); var $loadingOverlay = $container.find(".wp-allstars-loading-overlay");
// Show loading overlay
$container.css("position", "relative").append($loadingOverlay);
// AJAX request to get themes // AJAX request to get themes
$.ajax({ $.ajax({
url: ajaxurl, url: wpAllstars.ajaxurl,
type: "POST", type: "POST",
data: { data: {
action: "wp_allstars_get_themes", action: "wp_allstars_get_themes",
@ -153,11 +150,13 @@ class WP_Allstars_Theme_Manager {
*/ */
public static function display_tab_content() { public static function display_tab_content() {
?> ?>
<div id="wpa-theme-list" class="wpa-theme-container"> <div class="wp-allstars-settings-content tab-content" id="theme">
<!-- Theme content will be loaded via AJAX --> <div id="wpa-theme-list" class="wpa-theme-container">
<div class="wp-allstars-loading-overlay"> <!-- Theme content will be loaded via AJAX -->
<span class="spinner is-active"></span> <div class="wp-allstars-loading-overlay">
<p>Loading theme data...</p> <span class="spinner is-active"></span>
<p>Loading theme data...</p>
</div>
</div> </div>
</div> </div>
<?php <?php
@ -199,7 +198,8 @@ class WP_Allstars_Theme_Manager {
return; return;
} }
if (!check_ajax_referer('wp-allstars-nonce', '_wpnonce', false)) { // Use verify_nonce instead of check_ajax_referer for more reliable verification
if (!wp_verify_nonce($_POST['_wpnonce'], 'wp-allstars-nonce')) {
error_log('WP ALLSTARS: Invalid nonce: ' . sanitize_text_field($_POST['_wpnonce'])); error_log('WP ALLSTARS: Invalid nonce: ' . sanitize_text_field($_POST['_wpnonce']));
wp_send_json_error('Invalid security token sent.'); wp_send_json_error('Invalid security token sent.');
return; return;