Failed to load themes. Please try again. Error: " + error + "
");
console.error("AJAX Error:", xhr.responseText);
}
});
}
// Initialize theme handlers
window.initThemeHandlers = function() {
// Activate theme
$(".activate-now").click(function(e) {
e.preventDefault();
var $button = $(this);
var slug = $button.data("slug");
var name = $button.data("name");
var nonce = $button.data("nonce");
$button.text("Activating...").addClass("updating-message").attr("disabled", true);
$.ajax({
url: ajaxurl,
type: "POST",
data: {
action: "wp_allstars_activate_theme",
theme: slug,
_wpnonce: nonce
},
success: function(response) {
if (response.success) {
$button.removeClass("updating-message").addClass("updated-message").text("Activated");
setTimeout(function() {
window.location.reload();
}, 1000);
} else {
$button.removeClass("updating-message").text("Error");
alert("Error: " + response.data);
}
},
error: function(xhr, status, error) {
$button.removeClass("updating-message").text("Error");
alert("Error: " + error);
}
});
});
};
});
';
}
/**
* Display the theme tab content
*/
public static function display_tab_content() {
?>