Files
roi-theme/sidebar.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

57 lines
1.3 KiB
PHP

<?php
/**
* The sidebar template file
*
* This template displays the primary sidebar widget area.
* If no widgets are active, the sidebar will not be displayed.
*
* @package Apus_Theme
* @since 1.0.0
*/
// Exit if the sidebar is not active
if ( ! is_active_sidebar( 'sidebar-1' ) ) {
return;
}
?>
<div class="sidebar-sticky position-sticky" style="top: 5rem;">
<?php
/**
* Display Table of Contents (TOC) on single posts
* Issue #86 - TOC should be displayed in sidebar
*/
if (is_single() && function_exists('apus_extract_headings') && function_exists('apus_generate_toc')) {
global $post;
if (!empty($post->post_content)) {
$headings = apus_extract_headings($post->post_content);
$toc_html = apus_generate_toc($headings);
if (!empty($toc_html)) {
echo $toc_html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
}
}
?>
<?php
/**
* Display sidebar widgets
*
* Widgets can be added through Appearance > Widgets in the WordPress admin.
* The sidebar must be registered in functions.php for widgets to appear here.
*/
if (is_active_sidebar('sidebar-1')) {
dynamic_sidebar('sidebar-1');
}
?>
<?php
/**
* CTA Box Sidebar (Issue #36)
*
* Display CTA box below TOC on single posts
*/
get_template_part( 'template-parts/cta-box', 'sidebar' );
?>
</div><!-- .sidebar-sticky -->