diff --git a/Inc/adsense-placement.php b/Inc/adsense-placement.php index f28bf7c2..95b9fa80 100644 --- a/Inc/adsense-placement.php +++ b/Inc/adsense-placement.php @@ -184,7 +184,9 @@ function roi_inject_content_ads(string $content): string global $container; // DEBUG: Log para diagnosticar problema de ads no inyectados - error_log('ROI AdSense Debug: roi_inject_content_ads called'); + $post_id = get_the_ID(); + $post_url = get_permalink(); + error_log('ROI AdSense Debug: roi_inject_content_ads called for post_id=' . $post_id . ', url=' . $post_url); // Solo en posts individuales if (!is_single() || !in_the_loop() || !is_main_query()) { @@ -237,9 +239,11 @@ function roi_inject_content_ads(string $content): string ); $content = $injector->inject($content); - error_log('ROI AdSense Debug: Final injection done. postTop=' . strlen($postTopHtml) . ', postBottom=' . strlen($postBottomHtml)); + $finalContent = $postTopHtml . $content . $postBottomHtml; + error_log('ROI AdSense Debug: Final injection done. postTop=' . strlen($postTopHtml) . ', postBottom=' . strlen($postBottomHtml) . ', finalLength=' . strlen($finalContent)); + error_log('ROI AdSense Debug: First 200 chars of postTopHtml: ' . substr($postTopHtml, 0, 200)); - return $postTopHtml . $content . $postBottomHtml; + return $finalContent; } catch (\Throwable $e) { error_log('ROI AdSense Content ERROR: ' . $e->getMessage() . ' in ' . $e->getFile() . ':' . $e->getLine());