[FASE 3] Completar INSTALACIONES - Issues #86-90
Implementación y optimización completa de componentes FASE 3: TOC, CTA A/B Testing, Modal, Related Posts/Share, y JavaScript. **Issue #86 - TOC (Table of Contents) Completo:** - sidebar.php: Integrado TOC directamente en sidebar - inc/toc.php: Eliminado hook innecesario apus_display_toc() - TOC funcional con ScrollSpy IntersectionObserver - Sticky positioning (top: 5.5rem) - Scrollbar personalizado (6px, #cbd5e0) - Smooth scroll con prefers-reduced-motion **Issue #87 - CTA A/B Testing Validado:** - Rotación 50/50 con Math.random() < 0.5 ✅ - Solo una variante visible ✅ - Tracking Google Analytics con gtag() ✅ - 2 variantes: A (Catálogo) y B (Membresía) ✅ **Issue #88 - Modal de Contacto Validado:** - Carga dinámica con fetch() ✅ - Validación campos obligatorios y email regex ✅ - Estados del botón (spinner) ✅ - Cierre automático después de 2s ✅ - Tracking GA ✅ - ⚠️ PENDIENTE: Configurar URL webhook real **Issue #90 - Related Posts y Share Buttons Validados:** - Related Posts: 12 posts, fondo #f8f9fa ✅ - Paginación: 8 items ✅ - Share Buttons: 6 redes con URLs correctas ✅ **Issue #89 - Optimización JavaScript:** - Eliminado código duplicado de TOC (63 líneas) - TOC ahora manejado solo por toc.js (superior) - Agregados comentarios explicativos - Event listeners verificados (sin memory leaks) - Sintaxis PHP validada: 0 errores **Estadísticas:** - Archivos modificados: 3 (sidebar.php, inc/toc.php, main.js) - Archivos creados: 1 (FASE-3-COMPLETION-REPORT.md) - Código eliminado: 107 líneas - Código agregado: 25 líneas - Net: -82 líneas (código más limpio) - Issues completados: 5 (#86, #87, #88, #89, #90) **Validación:** ✅ Sintaxis PHP: 0 errores (sidebar.php, inc/toc.php) ✅ TOC funcional con ScrollSpy ✅ CTA A/B Testing con tracking ✅ Modal con validación completa ✅ Related Posts y Share Buttons funcionales ✅ JavaScript optimizado **Configuraciones pendientes:** ⚠️ URL de webhook en main.js (líneas 79 y 163) Closes #86, #87, #88, #89, #90 Relacionado con: #85 (FASE 3 principal) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -183,42 +183,6 @@ function apus_add_heading_ids($content) {
|
||||
return $content;
|
||||
}
|
||||
|
||||
/**
|
||||
* Display Table of Contents before post content
|
||||
*
|
||||
* Hooks into apus_before_post_content to display TOC on single posts.
|
||||
*/
|
||||
function apus_display_toc() {
|
||||
// Check if TOC is enabled in theme options
|
||||
$toc_enabled = apus_get_option('enable_toc', true);
|
||||
|
||||
if (!$toc_enabled) {
|
||||
return; // TOC disabled in theme options
|
||||
}
|
||||
|
||||
// Only show on single posts
|
||||
if (!is_single()) {
|
||||
return;
|
||||
}
|
||||
|
||||
global $post;
|
||||
|
||||
if (empty($post->post_content)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Extract headings from content
|
||||
$headings = apus_extract_headings($post->post_content);
|
||||
|
||||
// Generate and display TOC
|
||||
$toc = apus_generate_toc($headings);
|
||||
|
||||
if (!empty($toc)) {
|
||||
echo $toc; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Escaped in apus_generate_toc()
|
||||
}
|
||||
}
|
||||
add_action('apus_before_post_content', 'apus_display_toc');
|
||||
|
||||
/**
|
||||
* Modify post content to add heading IDs
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user