Files
roi-theme/inc/admin/options-page-template.php
FrankZamora bbc6ed2c98 Refactor: Reorganizar repositorio - Solo tema WordPress
Se movió el repositorio git desde la raíz de WordPress a la carpeta del tema.
Este commit limpia todos los archivos de WordPress del historial de tracking
y mantiene únicamente los archivos del tema apus-theme.

Cambios:
- Eliminado tracking de archivos de WordPress core
- Mantenido solo archivos del tema (97 archivos)
- Actualizado .gitignore para excluir carpetas de desarrollo
- Historial de commits anteriores se mantiene intacto

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-09 09:15:47 -06:00

662 lines
41 KiB
PHP

<?php
/**
* Theme Options Page Template
*
* @package Apus_Theme
* @since 1.0.0
*/
// Exit if accessed directly
if (!defined('ABSPATH')) {
exit;
}
// Get current options
$options = get_option('apus_theme_options', apus_get_default_options());
?>
<div class="wrap apus-theme-options">
<h1><?php echo esc_html(get_admin_page_title()); ?></h1>
<div class="apus-options-header">
<div class="apus-options-logo">
<h2><?php _e('Apus Theme', 'apus-theme'); ?></h2>
<span class="version"><?php echo 'v' . APUS_VERSION; ?></span>
</div>
<div class="apus-options-actions">
<button type="button" class="button button-secondary" id="apus-export-options">
<span class="dashicons dashicons-download"></span>
<?php _e('Export Options', 'apus-theme'); ?>
</button>
<button type="button" class="button button-secondary" id="apus-import-options">
<span class="dashicons dashicons-upload"></span>
<?php _e('Import Options', 'apus-theme'); ?>
</button>
<button type="button" class="button button-secondary" id="apus-reset-options">
<span class="dashicons dashicons-image-rotate"></span>
<?php _e('Reset to Defaults', 'apus-theme'); ?>
</button>
</div>
</div>
<form method="post" action="options.php" class="apus-options-form">
<?php
settings_fields('apus_theme_options_group');
?>
<div class="apus-options-container">
<!-- Tabs Navigation -->
<div class="apus-tabs-nav">
<ul>
<li class="active">
<a href="#general" data-tab="general">
<span class="dashicons dashicons-admin-settings"></span>
<?php _e('General', 'apus-theme'); ?>
</a>
</li>
<li>
<a href="#content" data-tab="content">
<span class="dashicons dashicons-edit-page"></span>
<?php _e('Content', 'apus-theme'); ?>
</a>
</li>
<li>
<a href="#performance" data-tab="performance">
<span class="dashicons dashicons-performance"></span>
<?php _e('Performance', 'apus-theme'); ?>
</a>
</li>
<li>
<a href="#related-posts" data-tab="related-posts">
<span class="dashicons dashicons-admin-links"></span>
<?php _e('Related Posts', 'apus-theme'); ?>
</a>
</li>
<li>
<a href="#advanced" data-tab="advanced">
<span class="dashicons dashicons-admin-tools"></span>
<?php _e('Advanced', 'apus-theme'); ?>
</a>
</li>
</ul>
</div>
<!-- Tabs Content -->
<div class="apus-tabs-content">
<!-- General Tab -->
<div id="general" class="apus-tab-pane active">
<h2><?php _e('General Settings', 'apus-theme'); ?></h2>
<p class="description"><?php _e('Configure general theme settings including logo, branding, and social media.', 'apus-theme'); ?></p>
<table class="form-table">
<!-- Site Logo -->
<tr>
<th scope="row">
<label for="site_logo"><?php _e('Site Logo', 'apus-theme'); ?></label>
</th>
<td>
<div class="apus-image-upload">
<input type="hidden" name="apus_theme_options[site_logo]" id="site_logo" value="<?php echo esc_attr($options['site_logo'] ?? 0); ?>" class="apus-image-id" />
<div class="apus-image-preview">
<?php
$logo_id = $options['site_logo'] ?? 0;
if ($logo_id) {
echo wp_get_attachment_image($logo_id, 'medium', false, array('class' => 'apus-preview-image'));
}
?>
</div>
<button type="button" class="button apus-upload-image"><?php _e('Upload Logo', 'apus-theme'); ?></button>
<button type="button" class="button apus-remove-image" <?php echo (!$logo_id ? 'style="display:none;"' : ''); ?>><?php _e('Remove Logo', 'apus-theme'); ?></button>
<p class="description"><?php _e('Upload your site logo. Recommended size: 200x60px', 'apus-theme'); ?></p>
</div>
</td>
</tr>
<!-- Site Favicon -->
<tr>
<th scope="row">
<label for="site_favicon"><?php _e('Site Favicon', 'apus-theme'); ?></label>
</th>
<td>
<div class="apus-image-upload">
<input type="hidden" name="apus_theme_options[site_favicon]" id="site_favicon" value="<?php echo esc_attr($options['site_favicon'] ?? 0); ?>" class="apus-image-id" />
<div class="apus-image-preview">
<?php
$favicon_id = $options['site_favicon'] ?? 0;
if ($favicon_id) {
echo wp_get_attachment_image($favicon_id, 'thumbnail', false, array('class' => 'apus-preview-image'));
}
?>
</div>
<button type="button" class="button apus-upload-image"><?php _e('Upload Favicon', 'apus-theme'); ?></button>
<button type="button" class="button apus-remove-image" <?php echo (!$favicon_id ? 'style="display:none;"' : ''); ?>><?php _e('Remove Favicon', 'apus-theme'); ?></button>
<p class="description"><?php _e('Upload your site favicon. Recommended size: 32x32px or 64x64px', 'apus-theme'); ?></p>
</div>
</td>
</tr>
<!-- Enable Breadcrumbs -->
<tr>
<th scope="row">
<label for="enable_breadcrumbs"><?php _e('Enable Breadcrumbs', 'apus-theme'); ?></label>
</th>
<td>
<label class="apus-switch">
<input type="checkbox" name="apus_theme_options[enable_breadcrumbs]" id="enable_breadcrumbs" value="1" <?php checked(isset($options['enable_breadcrumbs']) ? $options['enable_breadcrumbs'] : true, true); ?> />
<span class="apus-slider"></span>
</label>
<p class="description"><?php _e('Show breadcrumbs navigation on pages and posts', 'apus-theme'); ?></p>
</td>
</tr>
<!-- Breadcrumb Separator -->
<tr>
<th scope="row">
<label for="breadcrumb_separator"><?php _e('Breadcrumb Separator', 'apus-theme'); ?></label>
</th>
<td>
<input type="text" name="apus_theme_options[breadcrumb_separator]" id="breadcrumb_separator" value="<?php echo esc_attr($options['breadcrumb_separator'] ?? '>'); ?>" class="regular-text" />
<p class="description"><?php _e('Character or symbol to separate breadcrumb items (e.g., >, /, »)', 'apus-theme'); ?></p>
</td>
</tr>
<!-- Date Format -->
<tr>
<th scope="row">
<label for="date_format"><?php _e('Date Format', 'apus-theme'); ?></label>
</th>
<td>
<input type="text" name="apus_theme_options[date_format]" id="date_format" value="<?php echo esc_attr($options['date_format'] ?? 'd/m/Y'); ?>" class="regular-text" />
<p class="description"><?php _e('PHP date format (e.g., d/m/Y, m/d/Y, Y-m-d)', 'apus-theme'); ?></p>
</td>
</tr>
<!-- Time Format -->
<tr>
<th scope="row">
<label for="time_format"><?php _e('Time Format', 'apus-theme'); ?></label>
</th>
<td>
<input type="text" name="apus_theme_options[time_format]" id="time_format" value="<?php echo esc_attr($options['time_format'] ?? 'H:i'); ?>" class="regular-text" />
<p class="description"><?php _e('PHP time format (e.g., H:i, g:i A)', 'apus-theme'); ?></p>
</td>
</tr>
<!-- Copyright Text -->
<tr>
<th scope="row">
<label for="copyright_text"><?php _e('Copyright Text', 'apus-theme'); ?></label>
</th>
<td>
<textarea name="apus_theme_options[copyright_text]" id="copyright_text" rows="3" class="large-text"><?php echo esc_textarea($options['copyright_text'] ?? sprintf(__('&copy; %s %s. All rights reserved.', 'apus-theme'), date('Y'), get_bloginfo('name'))); ?></textarea>
<p class="description"><?php _e('Footer copyright text. HTML allowed.', 'apus-theme'); ?></p>
</td>
</tr>
</table>
<h3><?php _e('Social Media Links', 'apus-theme'); ?></h3>
<table class="form-table">
<!-- Facebook -->
<tr>
<th scope="row">
<label for="social_facebook"><?php _e('Facebook URL', 'apus-theme'); ?></label>
</th>
<td>
<input type="url" name="apus_theme_options[social_facebook]" id="social_facebook" value="<?php echo esc_url($options['social_facebook'] ?? ''); ?>" class="regular-text" placeholder="https://facebook.com/yourpage" />
</td>
</tr>
<!-- Twitter -->
<tr>
<th scope="row">
<label for="social_twitter"><?php _e('Twitter URL', 'apus-theme'); ?></label>
</th>
<td>
<input type="url" name="apus_theme_options[social_twitter]" id="social_twitter" value="<?php echo esc_url($options['social_twitter'] ?? ''); ?>" class="regular-text" placeholder="https://twitter.com/youraccount" />
</td>
</tr>
<!-- Instagram -->
<tr>
<th scope="row">
<label for="social_instagram"><?php _e('Instagram URL', 'apus-theme'); ?></label>
</th>
<td>
<input type="url" name="apus_theme_options[social_instagram]" id="social_instagram" value="<?php echo esc_url($options['social_instagram'] ?? ''); ?>" class="regular-text" placeholder="https://instagram.com/youraccount" />
</td>
</tr>
<!-- LinkedIn -->
<tr>
<th scope="row">
<label for="social_linkedin"><?php _e('LinkedIn URL', 'apus-theme'); ?></label>
</th>
<td>
<input type="url" name="apus_theme_options[social_linkedin]" id="social_linkedin" value="<?php echo esc_url($options['social_linkedin'] ?? ''); ?>" class="regular-text" placeholder="https://linkedin.com/company/yourcompany" />
</td>
</tr>
<!-- YouTube -->
<tr>
<th scope="row">
<label for="social_youtube"><?php _e('YouTube URL', 'apus-theme'); ?></label>
</th>
<td>
<input type="url" name="apus_theme_options[social_youtube]" id="social_youtube" value="<?php echo esc_url($options['social_youtube'] ?? ''); ?>" class="regular-text" placeholder="https://youtube.com/yourchannel" />
</td>
</tr>
</table>
</div>
<!-- Content Tab -->
<div id="content" class="apus-tab-pane">
<h2><?php _e('Content Settings', 'apus-theme'); ?></h2>
<p class="description"><?php _e('Configure content display settings for posts, pages, and archives.', 'apus-theme'); ?></p>
<table class="form-table">
<!-- Excerpt Length -->
<tr>
<th scope="row">
<label for="excerpt_length"><?php _e('Excerpt Length', 'apus-theme'); ?></label>
</th>
<td>
<input type="number" name="apus_theme_options[excerpt_length]" id="excerpt_length" value="<?php echo esc_attr($options['excerpt_length'] ?? 55); ?>" class="small-text" min="10" max="500" />
<p class="description"><?php _e('Number of words to show in excerpt', 'apus-theme'); ?></p>
</td>
</tr>
<!-- Excerpt More -->
<tr>
<th scope="row">
<label for="excerpt_more"><?php _e('Excerpt More Text', 'apus-theme'); ?></label>
</th>
<td>
<input type="text" name="apus_theme_options[excerpt_more]" id="excerpt_more" value="<?php echo esc_attr($options['excerpt_more'] ?? '...'); ?>" class="regular-text" />
<p class="description"><?php _e('Text to append at the end of excerpts', 'apus-theme'); ?></p>
</td>
</tr>
<!-- Default Post Layout -->
<tr>
<th scope="row">
<label for="default_post_layout"><?php _e('Default Post Layout', 'apus-theme'); ?></label>
</th>
<td>
<select name="apus_theme_options[default_post_layout]" id="default_post_layout">
<option value="right-sidebar" <?php selected($options['default_post_layout'] ?? 'right-sidebar', 'right-sidebar'); ?>><?php _e('Right Sidebar', 'apus-theme'); ?></option>
<option value="left-sidebar" <?php selected($options['default_post_layout'] ?? 'right-sidebar', 'left-sidebar'); ?>><?php _e('Left Sidebar', 'apus-theme'); ?></option>
<option value="no-sidebar" <?php selected($options['default_post_layout'] ?? 'right-sidebar', 'no-sidebar'); ?>><?php _e('No Sidebar (Full Width)', 'apus-theme'); ?></option>
</select>
<p class="description"><?php _e('Default layout for single posts', 'apus-theme'); ?></p>
</td>
</tr>
<!-- Default Page Layout -->
<tr>
<th scope="row">
<label for="default_page_layout"><?php _e('Default Page Layout', 'apus-theme'); ?></label>
</th>
<td>
<select name="apus_theme_options[default_page_layout]" id="default_page_layout">
<option value="right-sidebar" <?php selected($options['default_page_layout'] ?? 'right-sidebar', 'right-sidebar'); ?>><?php _e('Right Sidebar', 'apus-theme'); ?></option>
<option value="left-sidebar" <?php selected($options['default_page_layout'] ?? 'right-sidebar', 'left-sidebar'); ?>><?php _e('Left Sidebar', 'apus-theme'); ?></option>
<option value="no-sidebar" <?php selected($options['default_page_layout'] ?? 'right-sidebar', 'no-sidebar'); ?>><?php _e('No Sidebar (Full Width)', 'apus-theme'); ?></option>
</select>
<p class="description"><?php _e('Default layout for pages', 'apus-theme'); ?></p>
</td>
</tr>
<!-- Archive Posts Per Page -->
<tr>
<th scope="row">
<label for="archive_posts_per_page"><?php _e('Archive Posts Per Page', 'apus-theme'); ?></label>
</th>
<td>
<input type="number" name="apus_theme_options[archive_posts_per_page]" id="archive_posts_per_page" value="<?php echo esc_attr($options['archive_posts_per_page'] ?? 10); ?>" class="small-text" min="1" max="100" />
<p class="description"><?php _e('Number of posts to show on archive pages. Set to 0 to use WordPress default.', 'apus-theme'); ?></p>
</td>
</tr>
<!-- Show Featured Image on Single Posts -->
<tr>
<th scope="row">
<label for="show_featured_image_single"><?php _e('Show Featured Image', 'apus-theme'); ?></label>
</th>
<td>
<label class="apus-switch">
<input type="checkbox" name="apus_theme_options[show_featured_image_single]" id="show_featured_image_single" value="1" <?php checked(isset($options['show_featured_image_single']) ? $options['show_featured_image_single'] : true, true); ?> />
<span class="apus-slider"></span>
</label>
<p class="description"><?php _e('Display featured image at the top of single posts', 'apus-theme'); ?></p>
</td>
</tr>
<!-- Show Author Box -->
<tr>
<th scope="row">
<label for="show_author_box"><?php _e('Show Author Box', 'apus-theme'); ?></label>
</th>
<td>
<label class="apus-switch">
<input type="checkbox" name="apus_theme_options[show_author_box]" id="show_author_box" value="1" <?php checked(isset($options['show_author_box']) ? $options['show_author_box'] : true, true); ?> />
<span class="apus-slider"></span>
</label>
<p class="description"><?php _e('Display author information box on single posts', 'apus-theme'); ?></p>
</td>
</tr>
<!-- Enable Comments on Posts -->
<tr>
<th scope="row">
<label for="enable_comments_posts"><?php _e('Enable Comments on Posts', 'apus-theme'); ?></label>
</th>
<td>
<label class="apus-switch">
<input type="checkbox" name="apus_theme_options[enable_comments_posts]" id="enable_comments_posts" value="1" <?php checked(isset($options['enable_comments_posts']) ? $options['enable_comments_posts'] : true, true); ?> />
<span class="apus-slider"></span>
</label>
<p class="description"><?php _e('Allow comments on blog posts', 'apus-theme'); ?></p>
</td>
</tr>
<!-- Enable Comments on Pages -->
<tr>
<th scope="row">
<label for="enable_comments_pages"><?php _e('Enable Comments on Pages', 'apus-theme'); ?></label>
</th>
<td>
<label class="apus-switch">
<input type="checkbox" name="apus_theme_options[enable_comments_pages]" id="enable_comments_pages" value="1" <?php checked(isset($options['enable_comments_pages']) ? $options['enable_comments_pages'] : false, true); ?> />
<span class="apus-slider"></span>
</label>
<p class="description"><?php _e('Allow comments on pages', 'apus-theme'); ?></p>
</td>
</tr>
<!-- Show Post Meta -->
<tr>
<th scope="row">
<label for="show_post_meta"><?php _e('Show Post Meta', 'apus-theme'); ?></label>
</th>
<td>
<label class="apus-switch">
<input type="checkbox" name="apus_theme_options[show_post_meta]" id="show_post_meta" value="1" <?php checked(isset($options['show_post_meta']) ? $options['show_post_meta'] : true, true); ?> />
<span class="apus-slider"></span>
</label>
<p class="description"><?php _e('Display post meta information (date, author, etc.)', 'apus-theme'); ?></p>
</td>
</tr>
<!-- Show Post Tags -->
<tr>
<th scope="row">
<label for="show_post_tags"><?php _e('Show Post Tags', 'apus-theme'); ?></label>
</th>
<td>
<label class="apus-switch">
<input type="checkbox" name="apus_theme_options[show_post_tags]" id="show_post_tags" value="1" <?php checked(isset($options['show_post_tags']) ? $options['show_post_tags'] : true, true); ?> />
<span class="apus-slider"></span>
</label>
<p class="description"><?php _e('Display tags on single posts', 'apus-theme'); ?></p>
</td>
</tr>
<!-- Show Post Categories -->
<tr>
<th scope="row">
<label for="show_post_categories"><?php _e('Show Post Categories', 'apus-theme'); ?></label>
</th>
<td>
<label class="apus-switch">
<input type="checkbox" name="apus_theme_options[show_post_categories]" id="show_post_categories" value="1" <?php checked(isset($options['show_post_categories']) ? $options['show_post_categories'] : true, true); ?> />
<span class="apus-slider"></span>
</label>
<p class="description"><?php _e('Display categories on single posts', 'apus-theme'); ?></p>
</td>
</tr>
</table>
</div>
<!-- Performance Tab -->
<div id="performance" class="apus-tab-pane">
<h2><?php _e('Performance Settings', 'apus-theme'); ?></h2>
<p class="description"><?php _e('Optimize your site performance with these settings. Be careful when enabling these options.', 'apus-theme'); ?></p>
<table class="form-table">
<!-- Enable Lazy Loading -->
<tr>
<th scope="row">
<label for="enable_lazy_loading"><?php _e('Enable Lazy Loading', 'apus-theme'); ?></label>
</th>
<td>
<label class="apus-switch">
<input type="checkbox" name="apus_theme_options[enable_lazy_loading]" id="enable_lazy_loading" value="1" <?php checked(isset($options['enable_lazy_loading']) ? $options['enable_lazy_loading'] : true, true); ?> />
<span class="apus-slider"></span>
</label>
<p class="description"><?php _e('Enable lazy loading for images to improve page load times', 'apus-theme'); ?></p>
</td>
</tr>
<!-- Remove Emoji Scripts -->
<tr>
<th scope="row">
<label for="performance_remove_emoji"><?php _e('Remove Emoji Scripts', 'apus-theme'); ?></label>
</th>
<td>
<label class="apus-switch">
<input type="checkbox" name="apus_theme_options[performance_remove_emoji]" id="performance_remove_emoji" value="1" <?php checked(isset($options['performance_remove_emoji']) ? $options['performance_remove_emoji'] : true, true); ?> />
<span class="apus-slider"></span>
</label>
<p class="description"><?php _e('Remove WordPress emoji scripts and styles (reduces HTTP requests)', 'apus-theme'); ?></p>
</td>
</tr>
<!-- Remove Embeds -->
<tr>
<th scope="row">
<label for="performance_remove_embeds"><?php _e('Remove Embeds', 'apus-theme'); ?></label>
</th>
<td>
<label class="apus-switch">
<input type="checkbox" name="apus_theme_options[performance_remove_embeds]" id="performance_remove_embeds" value="1" <?php checked(isset($options['performance_remove_embeds']) ? $options['performance_remove_embeds'] : false, true); ?> />
<span class="apus-slider"></span>
</label>
<p class="description"><?php _e('Remove WordPress embed scripts if you don\'t use oEmbed', 'apus-theme'); ?></p>
</td>
</tr>
<!-- Remove Dashicons on Frontend -->
<tr>
<th scope="row">
<label for="performance_remove_dashicons"><?php _e('Remove Dashicons', 'apus-theme'); ?></label>
</th>
<td>
<label class="apus-switch">
<input type="checkbox" name="apus_theme_options[performance_remove_dashicons]" id="performance_remove_dashicons" value="1" <?php checked(isset($options['performance_remove_dashicons']) ? $options['performance_remove_dashicons'] : true, true); ?> />
<span class="apus-slider"></span>
</label>
<p class="description"><?php _e('Remove Dashicons from frontend for non-logged in users', 'apus-theme'); ?></p>
</td>
</tr>
<!-- Defer JavaScript -->
<tr>
<th scope="row">
<label for="performance_defer_js"><?php _e('Defer JavaScript', 'apus-theme'); ?></label>
</th>
<td>
<label class="apus-switch">
<input type="checkbox" name="apus_theme_options[performance_defer_js]" id="performance_defer_js" value="1" <?php checked(isset($options['performance_defer_js']) ? $options['performance_defer_js'] : false, true); ?> />
<span class="apus-slider"></span>
</label>
<p class="description"><?php _e('Add defer attribute to JavaScript files (may break some scripts)', 'apus-theme'); ?></p>
</td>
</tr>
<!-- Minify HTML -->
<tr>
<th scope="row">
<label for="performance_minify_html"><?php _e('Minify HTML', 'apus-theme'); ?></label>
</th>
<td>
<label class="apus-switch">
<input type="checkbox" name="apus_theme_options[performance_minify_html]" id="performance_minify_html" value="1" <?php checked(isset($options['performance_minify_html']) ? $options['performance_minify_html'] : false, true); ?> />
<span class="apus-slider"></span>
</label>
<p class="description"><?php _e('Minify HTML output to reduce page size', 'apus-theme'); ?></p>
</td>
</tr>
<!-- Disable Gutenberg -->
<tr>
<th scope="row">
<label for="performance_disable_gutenberg"><?php _e('Disable Gutenberg', 'apus-theme'); ?></label>
</th>
<td>
<label class="apus-switch">
<input type="checkbox" name="apus_theme_options[performance_disable_gutenberg]" id="performance_disable_gutenberg" value="1" <?php checked(isset($options['performance_disable_gutenberg']) ? $options['performance_disable_gutenberg'] : false, true); ?> />
<span class="apus-slider"></span>
</label>
<p class="description"><?php _e('Disable Gutenberg editor and revert to classic editor', 'apus-theme'); ?></p>
</td>
</tr>
</table>
</div>
<!-- Related Posts Tab -->
<div id="related-posts" class="apus-tab-pane">
<h2><?php _e('Related Posts Settings', 'apus-theme'); ?></h2>
<p class="description"><?php _e('Configure related posts display on single post pages.', 'apus-theme'); ?></p>
<table class="form-table">
<!-- Enable Related Posts -->
<tr>
<th scope="row">
<label for="enable_related_posts"><?php _e('Enable Related Posts', 'apus-theme'); ?></label>
</th>
<td>
<label class="apus-switch">
<input type="checkbox" name="apus_theme_options[enable_related_posts]" id="enable_related_posts" value="1" <?php checked(isset($options['enable_related_posts']) ? $options['enable_related_posts'] : true, true); ?> />
<span class="apus-slider"></span>
</label>
<p class="description"><?php _e('Show related posts at the end of single posts', 'apus-theme'); ?></p>
</td>
</tr>
<!-- Related Posts Count -->
<tr>
<th scope="row">
<label for="related_posts_count"><?php _e('Number of Related Posts', 'apus-theme'); ?></label>
</th>
<td>
<input type="number" name="apus_theme_options[related_posts_count]" id="related_posts_count" value="<?php echo esc_attr($options['related_posts_count'] ?? 3); ?>" class="small-text" min="1" max="12" />
<p class="description"><?php _e('How many related posts to display', 'apus-theme'); ?></p>
</td>
</tr>
<!-- Related Posts Taxonomy -->
<tr>
<th scope="row">
<label for="related_posts_taxonomy"><?php _e('Relate Posts By', 'apus-theme'); ?></label>
</th>
<td>
<select name="apus_theme_options[related_posts_taxonomy]" id="related_posts_taxonomy">
<option value="category" <?php selected($options['related_posts_taxonomy'] ?? 'category', 'category'); ?>><?php _e('Category', 'apus-theme'); ?></option>
<option value="tag" <?php selected($options['related_posts_taxonomy'] ?? 'category', 'tag'); ?>><?php _e('Tag', 'apus-theme'); ?></option>
<option value="both" <?php selected($options['related_posts_taxonomy'] ?? 'category', 'both'); ?>><?php _e('Category and Tag', 'apus-theme'); ?></option>
</select>
<p class="description"><?php _e('How to determine related posts', 'apus-theme'); ?></p>
</td>
</tr>
<!-- Related Posts Title -->
<tr>
<th scope="row">
<label for="related_posts_title"><?php _e('Related Posts Title', 'apus-theme'); ?></label>
</th>
<td>
<input type="text" name="apus_theme_options[related_posts_title]" id="related_posts_title" value="<?php echo esc_attr($options['related_posts_title'] ?? __('Related Posts', 'apus-theme')); ?>" class="regular-text" />
<p class="description"><?php _e('Title to display above related posts section', 'apus-theme'); ?></p>
</td>
</tr>
<!-- Related Posts Columns -->
<tr>
<th scope="row">
<label for="related_posts_columns"><?php _e('Columns', 'apus-theme'); ?></label>
</th>
<td>
<select name="apus_theme_options[related_posts_columns]" id="related_posts_columns">
<option value="2" <?php selected($options['related_posts_columns'] ?? 3, 2); ?>><?php _e('2 Columns', 'apus-theme'); ?></option>
<option value="3" <?php selected($options['related_posts_columns'] ?? 3, 3); ?>><?php _e('3 Columns', 'apus-theme'); ?></option>
<option value="4" <?php selected($options['related_posts_columns'] ?? 3, 4); ?>><?php _e('4 Columns', 'apus-theme'); ?></option>
</select>
<p class="description"><?php _e('Number of columns to display related posts', 'apus-theme'); ?></p>
</td>
</tr>
</table>
</div>
<!-- Advanced Tab -->
<div id="advanced" class="apus-tab-pane">
<h2><?php _e('Advanced Settings', 'apus-theme'); ?></h2>
<p class="description"><?php _e('Advanced customization options. Use with caution.', 'apus-theme'); ?></p>
<table class="form-table">
<!-- Custom CSS -->
<tr>
<th scope="row">
<label for="custom_css"><?php _e('Custom CSS', 'apus-theme'); ?></label>
</th>
<td>
<textarea name="apus_theme_options[custom_css]" id="custom_css" rows="10" class="large-text code"><?php echo esc_textarea($options['custom_css'] ?? ''); ?></textarea>
<p class="description"><?php _e('Add custom CSS code. This will be added to the &lt;head&gt; section.', 'apus-theme'); ?></p>
</td>
</tr>
<!-- Custom JS Header -->
<tr>
<th scope="row">
<label for="custom_js_header"><?php _e('Custom JavaScript (Header)', 'apus-theme'); ?></label>
</th>
<td>
<textarea name="apus_theme_options[custom_js_header]" id="custom_js_header" rows="10" class="large-text code"><?php echo esc_textarea($options['custom_js_header'] ?? ''); ?></textarea>
<p class="description"><?php _e('Add custom JavaScript code. This will be added to the &lt;head&gt; section. Do not include &lt;script&gt; tags.', 'apus-theme'); ?></p>
</td>
</tr>
<!-- Custom JS Footer -->
<tr>
<th scope="row">
<label for="custom_js_footer"><?php _e('Custom JavaScript (Footer)', 'apus-theme'); ?></label>
</th>
<td>
<textarea name="apus_theme_options[custom_js_footer]" id="custom_js_footer" rows="10" class="large-text code"><?php echo esc_textarea($options['custom_js_footer'] ?? ''); ?></textarea>
<p class="description"><?php _e('Add custom JavaScript code. This will be added before the closing &lt;/body&gt; tag. Do not include &lt;script&gt; tags.', 'apus-theme'); ?></p>
</td>
</tr>
</table>
</div>
</div>
</div>
<?php submit_button(__('Save All Settings', 'apus-theme'), 'primary large', 'submit', true); ?>
</form>
</div>
<!-- Import Modal -->
<div id="apus-import-modal" class="apus-modal" style="display:none;">
<div class="apus-modal-content">
<span class="apus-modal-close">&times;</span>
<h2><?php _e('Import Options', 'apus-theme'); ?></h2>
<p><?php _e('Paste your exported options JSON here:', 'apus-theme'); ?></p>
<textarea id="apus-import-data" rows="10" class="large-text code"></textarea>
<p>
<button type="button" class="button button-primary" id="apus-import-submit"><?php _e('Import', 'apus-theme'); ?></button>
<button type="button" class="button" id="apus-import-cancel"><?php _e('Cancel', 'apus-theme'); ?></button>
</p>
</div>
</div>