fix(analytics): Corregir URLs en analytics usando post_name desde BD
Problema: - URLs en analytics mostraban dominio incorrecto (HTTP_HOST) - URLs usaban formato /?p=ID en lugar de permalinks Solución: - class-search-engine.php: Agregar propiedad $prefix, incluir p.post_name en 5 queries fetch, agregar helpers getSiteUrlFromDb(), getPermalinkStructure() y buildPermalink() - search-endpoint.php: Obtener site_url y permalink_structure desde wp_options, construir URLs con post_name - click-endpoint.php: Fallback de dest usando post_name desde BD Archivos modificados: - includes/class-search-engine.php - api/search-endpoint.php - api/click-endpoint.php 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
414
assets/css/search-ui.css
Normal file
414
assets/css/search-ui.css
Normal file
@@ -0,0 +1,414 @@
|
||||
/**
|
||||
* ROI APU Search UI Styles
|
||||
*
|
||||
* @package ROI_APU_Search
|
||||
*/
|
||||
|
||||
/* Variables */
|
||||
:root {
|
||||
--roi-apu-primary: #0d6efd;
|
||||
--roi-apu-primary-hover: #0b5ed7;
|
||||
--roi-apu-bg: #ffffff;
|
||||
--roi-apu-bg-secondary: #f8f9fa;
|
||||
--roi-apu-border: #dee2e6;
|
||||
--roi-apu-text: #212529;
|
||||
--roi-apu-text-muted: #6c757d;
|
||||
--roi-apu-highlight: #fff3cd;
|
||||
--roi-apu-error: #dc3545;
|
||||
--roi-apu-success: #198754;
|
||||
--roi-apu-radius: 8px;
|
||||
--roi-apu-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
||||
--roi-apu-transition: 0.2s ease;
|
||||
}
|
||||
|
||||
/* Container */
|
||||
.roi-apu-search-container {
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
|
||||
font-size: 16px;
|
||||
line-height: 1.5;
|
||||
color: var(--roi-apu-text);
|
||||
max-width: 100%;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
/* Search Form */
|
||||
.roi-apu-search-form {
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.roi-apu-input-wrapper {
|
||||
display: flex;
|
||||
gap: 0.5rem;
|
||||
background: var(--roi-apu-bg);
|
||||
border: 2px solid var(--roi-apu-border);
|
||||
border-radius: var(--roi-apu-radius);
|
||||
padding: 0.25rem;
|
||||
transition: border-color var(--roi-apu-transition), box-shadow var(--roi-apu-transition);
|
||||
}
|
||||
|
||||
.roi-apu-input-wrapper:focus-within {
|
||||
border-color: var(--roi-apu-primary);
|
||||
box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.15);
|
||||
}
|
||||
|
||||
.roi-apu-search-input {
|
||||
flex: 1;
|
||||
border: none;
|
||||
padding: 0.75rem 1rem;
|
||||
font-size: 1rem;
|
||||
background: transparent;
|
||||
outline: none;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.roi-apu-search-input::placeholder {
|
||||
color: var(--roi-apu-text-muted);
|
||||
}
|
||||
|
||||
.roi-apu-search-btn {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
padding: 0.75rem 1.25rem;
|
||||
background: var(--roi-apu-primary);
|
||||
color: white;
|
||||
border: none;
|
||||
border-radius: calc(var(--roi-apu-radius) - 4px);
|
||||
font-size: 1rem;
|
||||
font-weight: 500;
|
||||
cursor: pointer;
|
||||
transition: background-color var(--roi-apu-transition);
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.roi-apu-search-btn:hover:not(:disabled) {
|
||||
background: var(--roi-apu-primary-hover);
|
||||
}
|
||||
|
||||
.roi-apu-search-btn:disabled {
|
||||
opacity: 0.6;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
.roi-apu-search-btn svg {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
/* Error Message */
|
||||
.roi-apu-error {
|
||||
margin-top: 0.5rem;
|
||||
padding: 0.75rem 1rem;
|
||||
background: #f8d7da;
|
||||
color: var(--roi-apu-error);
|
||||
border-radius: var(--roi-apu-radius);
|
||||
font-size: 0.875rem;
|
||||
}
|
||||
|
||||
/* Loading */
|
||||
.roi-apu-loading {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 0.75rem;
|
||||
padding: 2rem;
|
||||
color: var(--roi-apu-text-muted);
|
||||
}
|
||||
|
||||
.roi-apu-spinner {
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
border: 3px solid var(--roi-apu-border);
|
||||
border-top-color: var(--roi-apu-primary);
|
||||
border-radius: 50%;
|
||||
animation: roi-apu-spin 0.8s linear infinite;
|
||||
}
|
||||
|
||||
@keyframes roi-apu-spin {
|
||||
to { transform: rotate(360deg); }
|
||||
}
|
||||
|
||||
/* Info Bar */
|
||||
.roi-apu-info {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 0.75rem 1rem;
|
||||
background: var(--roi-apu-bg-secondary);
|
||||
border-radius: var(--roi-apu-radius);
|
||||
margin-bottom: 1rem;
|
||||
font-size: 0.875rem;
|
||||
}
|
||||
|
||||
.roi-apu-info-total {
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.roi-apu-info-time {
|
||||
color: var(--roi-apu-text-muted);
|
||||
}
|
||||
|
||||
/* Results */
|
||||
.roi-apu-results-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
.roi-apu-result-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 1rem;
|
||||
padding: 1rem;
|
||||
background: var(--roi-apu-bg);
|
||||
border: 1px solid var(--roi-apu-border);
|
||||
border-radius: var(--roi-apu-radius);
|
||||
text-decoration: none;
|
||||
color: inherit;
|
||||
transition: border-color var(--roi-apu-transition), box-shadow var(--roi-apu-transition);
|
||||
}
|
||||
|
||||
.roi-apu-result-item:hover {
|
||||
border-color: var(--roi-apu-primary);
|
||||
box-shadow: var(--roi-apu-shadow);
|
||||
}
|
||||
|
||||
.roi-apu-result-position {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
background: var(--roi-apu-bg-secondary);
|
||||
border-radius: 50%;
|
||||
font-size: 0.75rem;
|
||||
font-weight: 600;
|
||||
color: var(--roi-apu-text-muted);
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.roi-apu-result-content {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.roi-apu-result-title {
|
||||
margin: 0 0 0.25rem;
|
||||
font-size: 1rem;
|
||||
font-weight: 500;
|
||||
line-height: 1.4;
|
||||
color: var(--roi-apu-text);
|
||||
}
|
||||
|
||||
.roi-apu-result-title mark {
|
||||
background: var(--roi-apu-highlight);
|
||||
padding: 0 2px;
|
||||
border-radius: 2px;
|
||||
}
|
||||
|
||||
.roi-apu-result-date {
|
||||
font-size: 0.8125rem;
|
||||
color: var(--roi-apu-text-muted);
|
||||
}
|
||||
|
||||
.roi-apu-result-arrow {
|
||||
flex-shrink: 0;
|
||||
color: var(--roi-apu-text-muted);
|
||||
transition: transform var(--roi-apu-transition), color var(--roi-apu-transition);
|
||||
}
|
||||
|
||||
.roi-apu-result-item:hover .roi-apu-result-arrow {
|
||||
transform: translateX(4px);
|
||||
color: var(--roi-apu-primary);
|
||||
}
|
||||
|
||||
/* No Results */
|
||||
.roi-apu-no-results {
|
||||
text-align: center;
|
||||
padding: 3rem 2rem;
|
||||
background: var(--roi-apu-bg-secondary);
|
||||
border-radius: var(--roi-apu-radius);
|
||||
}
|
||||
|
||||
.roi-apu-no-results p {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.roi-apu-no-results p:first-child {
|
||||
font-size: 1.125rem;
|
||||
margin-bottom: 0.5rem;
|
||||
}
|
||||
|
||||
.roi-apu-suggestions {
|
||||
color: var(--roi-apu-text-muted);
|
||||
font-size: 0.875rem;
|
||||
}
|
||||
|
||||
/* Pagination */
|
||||
.roi-apu-pagination {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
margin-top: 1.5rem;
|
||||
}
|
||||
|
||||
.roi-apu-pagination-inner {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.25rem;
|
||||
flex-wrap: wrap;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.roi-apu-page-btn {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
min-width: 40px;
|
||||
height: 40px;
|
||||
padding: 0 0.75rem;
|
||||
background: var(--roi-apu-bg);
|
||||
border: 1px solid var(--roi-apu-border);
|
||||
border-radius: var(--roi-apu-radius);
|
||||
font-size: 0.875rem;
|
||||
cursor: pointer;
|
||||
transition: all var(--roi-apu-transition);
|
||||
}
|
||||
|
||||
.roi-apu-page-btn:hover:not(.roi-apu-page-active) {
|
||||
background: var(--roi-apu-bg-secondary);
|
||||
border-color: var(--roi-apu-primary);
|
||||
}
|
||||
|
||||
.roi-apu-page-btn.roi-apu-page-active {
|
||||
background: var(--roi-apu-primary);
|
||||
border-color: var(--roi-apu-primary);
|
||||
color: white;
|
||||
}
|
||||
|
||||
.roi-apu-page-btn.roi-apu-prev,
|
||||
.roi-apu-page-btn.roi-apu-next {
|
||||
padding: 0 1rem;
|
||||
}
|
||||
|
||||
.roi-apu-page-ellipsis {
|
||||
padding: 0 0.5rem;
|
||||
color: var(--roi-apu-text-muted);
|
||||
}
|
||||
|
||||
/* Responsive */
|
||||
@media (max-width: 640px) {
|
||||
.roi-apu-input-wrapper {
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.roi-apu-search-btn {
|
||||
width: 100%;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.roi-apu-btn-text {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
.roi-apu-result-item {
|
||||
padding: 0.875rem;
|
||||
}
|
||||
|
||||
.roi-apu-result-position {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.roi-apu-info {
|
||||
flex-direction: column;
|
||||
gap: 0.25rem;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.roi-apu-page-btn.roi-apu-prev,
|
||||
.roi-apu-page-btn.roi-apu-next {
|
||||
padding: 0 0.5rem;
|
||||
font-size: 0.8125rem;
|
||||
}
|
||||
}
|
||||
|
||||
/* Hide text on very small screens */
|
||||
@media (max-width: 480px) {
|
||||
.roi-apu-btn-text {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.roi-apu-search-btn {
|
||||
padding: 0.75rem;
|
||||
}
|
||||
}
|
||||
|
||||
/* =================================================================
|
||||
Anuncios en resultados de busqueda
|
||||
Usa variables CSS del tema para consistencia
|
||||
VISIBLES por defecto para que AdSense pueda medirlos y llenarlos
|
||||
Se ocultan via JS si no se llenan despues del timeout
|
||||
================================================================= */
|
||||
|
||||
.roi-apu-ad-item {
|
||||
/* VISIBLE por defecto - AdSense necesita medir el elemento */
|
||||
display: block;
|
||||
|
||||
/* Spacing usando variables del tema o fallbacks */
|
||||
padding: var(--roi-spacing-md, 1rem);
|
||||
margin: var(--roi-spacing-sm, 0.5rem) 0;
|
||||
|
||||
/* Fondo sutil que no compita con resultados */
|
||||
background: var(--roi-bg-light, #f8f9fa);
|
||||
border-radius: var(--roi-radius-sm, 0.375rem);
|
||||
|
||||
/* Centrar contenido del anuncio */
|
||||
text-align: center;
|
||||
|
||||
/* Borde sutil para separar del contenido */
|
||||
border: 1px solid var(--roi-border-light, rgba(0,0,0,0.05));
|
||||
|
||||
/* Altura minima para que AdSense pueda renderizar */
|
||||
min-height: 100px;
|
||||
}
|
||||
|
||||
/* Ocultar ads que no se llenaron (clase agregada via JS) */
|
||||
.roi-apu-ad-item.ad-unfilled {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.roi-apu-ad-item ins.adsbygoogle {
|
||||
display: block !important;
|
||||
min-height: 100px; /* Altura minima para evitar CLS */
|
||||
}
|
||||
|
||||
/* Anuncio superior - mas prominente */
|
||||
.roi-apu-ad-item[data-ad-position="top"] {
|
||||
margin-top: 0;
|
||||
margin-bottom: var(--roi-spacing-md, 1rem);
|
||||
background: var(--roi-bg-muted, #f1f3f4);
|
||||
}
|
||||
|
||||
/* Anuncios entre resultados - menos intrusivos */
|
||||
.roi-apu-ad-item:not([data-ad-position="top"]) {
|
||||
margin: var(--roi-spacing-md, 1rem) 0;
|
||||
}
|
||||
|
||||
/* Responsive: En movil, padding reducido */
|
||||
@media (max-width: 768px) {
|
||||
.roi-apu-ad-item {
|
||||
padding: var(--roi-spacing-sm, 0.5rem);
|
||||
}
|
||||
|
||||
.roi-apu-ad-item ins.adsbygoogle {
|
||||
min-height: 80px;
|
||||
}
|
||||
}
|
||||
|
||||
/* =================================================================
|
||||
Dark Mode Support
|
||||
El input siempre tiene fondo blanco, forzar texto oscuro
|
||||
================================================================= */
|
||||
@media (prefers-color-scheme: dark) {
|
||||
.roi-apu-search-input {
|
||||
color: var(--roi-apu-text);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user