diff --git a/Inc/adsense-placement.php b/Inc/adsense-placement.php index 6ef46e9c..f9e29bac 100644 --- a/Inc/adsense-placement.php +++ b/Inc/adsense-placement.php @@ -97,9 +97,6 @@ function roi_render_rail_ads(): string global $container; if ($container === null) { - if (defined('WP_DEBUG') && WP_DEBUG) { - error_log('ROI Rail Ads: container is NULL'); - } return ''; } @@ -108,34 +105,22 @@ function roi_render_rail_ads(): string $settings = $repository->getComponentSettings('adsense-placement'); if (empty($settings)) { - if (defined('WP_DEBUG') && WP_DEBUG) { - error_log('ROI Rail Ads: settings are EMPTY'); - } return ''; } // Verificar exclusiones if (roi_is_ad_excluded($settings)) { - if (defined('WP_DEBUG') && WP_DEBUG) { - error_log('ROI Rail Ads: EXCLUDED by roi_is_ad_excluded'); - } return ''; } // Obtener renderer desde DIContainer (DIP compliant) $renderer = $container->getAdsensePlacementRenderer(); - $html = $renderer->renderRailAds($settings); - - if (defined('WP_DEBUG') && WP_DEBUG) { - error_log('ROI Rail Ads: renderRailAds returned ' . strlen($html) . ' chars'); - } - - return $html; + return $renderer->renderRailAds($settings); } catch (\Throwable $e) { if (defined('WP_DEBUG') && WP_DEBUG) { - error_log('ROI AdSense Rail Ads ERROR: ' . $e->getMessage()); + error_log('ROI AdSense Rail Ads: ' . $e->getMessage()); } return ''; } @@ -145,19 +130,8 @@ function roi_render_rail_ads(): string * Hook para inyectar Rail Ads en el footer */ add_action('wp_footer', function() { - // DEBUG: Verificar que el hook se ejecuta - if (defined('WP_DEBUG') && WP_DEBUG) { - error_log('ROI Rail Ads: wp_footer hook fired'); - } - - $output = roi_render_rail_ads(); - - if (defined('WP_DEBUG') && WP_DEBUG) { - error_log('ROI Rail Ads: output length = ' . strlen($output)); - } - // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped - echo $output; + echo roi_render_rail_ads(); }, 50); /** diff --git a/Public/AdsensePlacement/Infrastructure/Ui/AdsensePlacementRenderer.php b/Public/AdsensePlacement/Infrastructure/Ui/AdsensePlacementRenderer.php index 30427d8e..4fba7081 100644 --- a/Public/AdsensePlacement/Infrastructure/Ui/AdsensePlacementRenderer.php +++ b/Public/AdsensePlacement/Infrastructure/Ui/AdsensePlacementRenderer.php @@ -362,9 +362,7 @@ final class AdsensePlacementRenderer /** * EXCEPCION DOCUMENTADA: CSS inline requerido por Google AdSense - * Usamos display:block con data-full-width-responsive="true" para que - * el anuncio se adapte automaticamente al ancho del contenedor responsive. - * La altura se controla via el selector de formato. + * El anuncio usa tamaƱo fijo (160xHeight) centrado en el container responsive. * Ref: https://support.google.com/adsense/answer/9274516 */ @@ -372,9 +370,8 @@ final class AdsensePlacementRenderer if ($leftEnabled) { $html .= sprintf( '
- +
', $height, esc_attr($publisherId), esc_attr($slotId), $scriptType, $dataAttr @@ -385,9 +382,8 @@ final class AdsensePlacementRenderer if ($rightEnabled) { $html .= sprintf( '
- +
', $height, esc_attr($publisherId), esc_attr($slotId), $scriptType, $dataAttr