File: //var/www/test.kaunokolegija.lt/kk_wp_content/plugins/events/admin/settings.php
<?php
// Prevent direct access
if (!defined('ABSPATH')) {
exit;
}
// Handle form submission
if ($_POST && wp_verify_nonce($_POST['kauno_events_settings_nonce'], 'kauno_events_settings_save')) {
$show_breadcrumb = isset($_POST['show_breadcrumb']) ? 1 : 0;
update_option('kauno_events_show_breadcrumb', $show_breadcrumb);
$success_message = __('Settings saved successfully!', 'kauno-events');
}
// Get current settings
$show_breadcrumb = get_option('kauno_events_show_breadcrumb', 1); // Default to enabled
?>
<div class="wrap kauno-events-settings">
<div class="settings-header">
<h1>
<span>⚙️</span>
<?php _e('Kauno Events Settings', 'kauno-events'); ?>
</h1>
<p><?php _e('Configure your events plugin settings', 'kauno-events'); ?></p>
</div>
<?php if (isset($success_message)): ?>
<div class="notice notice-success">
<p><?php echo esc_html($success_message); ?></p>
</div>
<?php endif; ?>
<div class="settings-content">
<form method="post" class="settings-form">
<?php wp_nonce_field('kauno_events_settings_save', 'kauno_events_settings_nonce'); ?>
<div class="settings-section">
<h2><?php _e('Display Settings', 'kauno-events'); ?></h2>
<div class="setting-item">
<label class="checkbox-label">
<input type="checkbox"
name="show_breadcrumb"
value="1"
<?php checked($show_breadcrumb, 1); ?>>
<span class="checkbox-custom"></span>
<?php _e('Show breadcrumb on event detail pages', 'kauno-events'); ?>
</label>
<p class="setting-description">
<?php _e('Enable or disable the breadcrumb navigation on event detail pages.', 'kauno-events'); ?>
</p>
</div>
</div>
<div class="settings-actions">
<button type="submit" class="button button-primary">
<?php _e('Save Settings', 'kauno-events'); ?>
</button>
</div>
</form>
</div>
</div>
<style>
.kauno-events-settings {
max-width: 800px;
margin: 20px 0;
}
.settings-header {
background: linear-gradient(135deg, #0d9488 0%, #0f766e 100%);
color: white;
padding: 2rem;
border-radius: 12px;
margin-bottom: 2rem;
}
.settings-header h1 {
font-size: 2rem;
font-weight: 700;
margin: 0 0 0.5rem 0;
display: flex;
align-items: center;
gap: 0.75rem;
}
.settings-header p {
margin: 0;
opacity: 0.9;
font-size: 1rem;
}
.settings-content {
background: white;
border-radius: 12px;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
border: 1px solid #e2e8f0;
overflow: hidden;
}
.settings-form {
padding: 2rem;
}
.settings-section {
margin-bottom: 2rem;
}
.settings-section h2 {
font-size: 1.5rem;
font-weight: 600;
color: #1e293b;
margin: 0 0 1.5rem 0;
padding-bottom: 0.75rem;
border-bottom: 2px solid #e2e8f0;
}
.setting-item {
margin-bottom: 1.5rem;
padding: 1.5rem;
background: #f8fafc;
border-radius: 8px;
border: 1px solid #e2e8f0;
}
.checkbox-label {
display: flex;
align-items: flex-start;
gap: 0.75rem;
cursor: pointer;
font-weight: 500;
color: #374151;
}
.checkbox-label input[type="checkbox"] {
margin: 0;
width: 18px;
height: 18px;
accent-color: #0d9488;
}
.setting-description {
margin: 0.5rem 0 0 2.25rem;
color: #64748b;
font-size: 0.875rem;
line-height: 1.5;
}
.settings-actions {
padding-top: 1.5rem;
border-top: 1px solid #e2e8f0;
margin-top: 2rem;
}
.button-primary {
background: #0d9488 !important;
border-color: #0d9488 !important;
color: white !important;
padding: 0.75rem 1.5rem !important;
border-radius: 6px !important;
font-weight: 600 !important;
transition: all 0.2s !important;
}
.button-primary:hover {
background: #0f766e !important;
border-color: #0f766e !important;
transform: translateY(-1px) !important;
}
.notice-success {
background: #dcfce7;
color: #166534;
padding: 1rem 1.5rem;
border-radius: 8px;
border: 1px solid #bbf7d0;
margin-bottom: 1.5rem;
}
@media (max-width: 768px) {
.settings-header {
padding: 1.5rem;
}
.settings-form {
padding: 1.5rem;
}
.setting-item {
padding: 1rem;
}
}
</style>