Google Adsense and WordPress
-
Google Adsense is putting a banner in my navigation menu automatically. Is there anyway, I can move it underneath between the menu and the content? It looks bad right now. Thanks in advance.
-
Are you using some plugin to add adsense to your site? I don’t see any ads when I look.
Using just the script tag they provide in the head section of the header.php file.
<script> (adsbygoogle = window.adsbygoogle || []).push({ google_ad_client: "ca-pub-7282003640012354", enable_page_level_ads: true }); </script>Hello!
Remove the code from there and use this plugin: https://ww.wp.xz.cn/plugins/insert-headers-and-footers/. Add the code in the head section of the plugin.
Blade, I just tried that and got the same result.
This code needs to be where you want the ad to appear
can you paste the last few lines of the header.php file?
<?php /** * The header for our theme. * * This is the template that displays all of the <head> section and everything up until <div id="content"> * * @link https://developer.ww.wp.xz.cn/themes/basics/template-files/#template-partials * * @package Bhari * @since 1.0 */ ?><!DOCTYPE html> <?php bhari_html_before(); ?> <html <?php language_attributes(); ?>> <head> <?php bhari_head_top(); ?> <meta charset="<?php bloginfo('charset'); ?>"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="profile" href="http://gmpg.org/xfn/11"> <?php bhari_head_bottom(); ?> <?php wp_head(); ?> <script>window._epn = {campaign:5338146318};</script> <script src="https://epnt.ebay.com/static/epn-smart-tools.js"></script> <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> <script> (adsbygoogle = window.adsbygoogle || []).push({ google_ad_client: "ca-pub-7282003640012354", enable_page_level_ads: true }); </script> </head> <body <?php body_class(); ?>> <?php bhari_body_top(); ?> <div id="page" class="site"> <a class="skip-link screen-reader-text" href="#content"><?php esc_html_e('Skip to content', 'bhari'); ?></a> <?php bhari_header_before(); ?> <header id="masthead" class="site-header" role="banner"> <?php bhari_header_top(); ?> <div class="site-branding"> <?php if (is_front_page() && is_home() ) : ?> <h1 class="site-title"><a href="<?php echo esc_url(home_url('/')); ?>" rel="home"><?php bloginfo('name'); ?></a></h1> <?php else : ?> <p class="site-title"><a href="<?php echo esc_url(home_url('/')); ?>" rel="home"><?php bloginfo('name'); ?></a></p> <?php endif; ?> <?php $description = get_bloginfo('description', 'display'); ?> <?php if ($description || is_customize_preview() ) : ?> <p class="site-description"><?php echo $description; /* WPCS: xss ok. */ ?></p> <?php endif; ?> </div><!-- .site-branding --> <nav id="site-navigation" class="main-navigation" role="navigation"> <button class="menu-toggle" aria-controls="primary-menu" aria-expanded="false"> <?php if (BHARI_SUPPORT_FONTAWESOME ) : ?> <i class="fa fa-reorder" aria-hidden="true"></i> <?php endif; ?> <?php esc_html_e('Primary Menu', 'bhari'); ?> </button> <?php wp_nav_menu(array( 'theme_location' => 'primary', 'menu_id' => 'primary-menu' )); ?> </nav><!-- #site-navigation --> <?php bhari_header_bottom(); ?> </header><!-- #masthead --> <?php bhari_header_after(); ?> <?php if (get_header_image() ) : ?> <div class="custom-headers"> <a href="<?php echo esc_url(home_url('/')); ?>" rel="home"> <img src="<?php header_image(); ?>" width="<?php echo esc_attr(get_custom_header()->width); ?>" height="<?php echo esc_attr(get_custom_header()->height); ?>" alt=""> </a> </div> <?php endif; // End header image check. ?> <?php bhari_content_before(); ?> <div id="content" class="site-content"> <?php bhari_content_top(); ?>Any workarounds for this issue?
The topic ‘Google Adsense and WordPress’ is closed to new replies.