Viewing 15 replies - 1 through 15 (of 17 total)
  • Hi rspisarski. The Google Publisher plugin is supposed to be able to place ads in your pages without having to manually modify the code. If you do need to manually insert the code you should set up a child theme if you’re not already using one. Then copy the header.php file from the parent theme to your child theme folder, and modify that copy.

    Thread Starter rspisarski

    (@rspisarski)

    Hey thanks for the reply. I tried the plugin and it would not load when I goto setup thru google. I get a error message. Do you have a tutorial or anything on setting up a child theme?

    Options for creating a child theme:

    1. Do it manually using this process.

    2. Use the One Click Child Theme plugin.

    3. Download a pre-configured sample child theme from the author’s web site.

    Thread Starter rspisarski

    (@rspisarski)

    Okay I got the child theme installed and I have the header.php, I cant figure out how to insert in manually tho.

    Here is an example where I inserted a <div> for the ad box in header.php just above the main navigation. The following css will set the size, a red border and centered:

    #adbox {
      height: 90px;
      width: 728px;
      border: 1px solid red;
      margin: 10px auto;
      }

    Hi,
    Not sure if I should create a thread of my own, but this seems to be the same problem.
    How would you go with adding an image instead of an adsense ad?

    https://www.progressersurleagueoflegends.fr

    I’d like to add another image on the right of the already existing one. It’s actually an ad, but just an ad with a link towards another website.

    Any help would be greatly appreciated ??

    Hi klimrod. Yes, it would be better if you started your own topic. Thanks.

    Thread Starter rspisarski

    (@rspisarski)

    If I give you my code for the header.php can you put it in correctly. I know nothing about php coding. I have html experience but that’s it. I would greatly appreciate it

    I updated the example to show the entire default header.php file and where the adbox code was inserted:

    <!-- BEGIN Ad Box -->
    <div id="adbox">
    <!-- the code for your ad would go here -->
    </div>
    <!-- END Ad Box -->

    You would replace the comment line in the div with whatever you want to display in the adbox, then use css to style the #adbox container. Does that help?

    Thread Starter rspisarski

    (@rspisarski)

    I see how you are doing it but my code looks different…

    <!DOCTYPE html>
    <html class="no-js" <?php language_attributes(); ?>>
    
    <head>
    	<meta charset="<?php bloginfo('charset'); ?>">
    	<meta name="viewport" content="width=device-width, initial-scale=1.0">
    
    	<title><?php wp_title(''); ?></title>
    
    	<link rel="pingback" href="<?php bloginfo('pingback_url'); ?>">
    
    	<?php wp_head(); ?>
    </head>
    
    <body <?php body_class(); ?>>
    
    <div id="wrapper">
    
    	<header id="header">
    
    		<?php if (has_nav_menu('topbar')): ?>
    			<nav class="nav-container group" id="nav-topbar">
    				<div class="nav-toggle"><i class="fa fa-bars"></i></div>
    				<div class="nav-text"><!-- put your mobile menu text here --></div>
    				<div class="nav-wrap container"><?php wp_nav_menu(array('theme_location'=>'topbar','menu_class'=>'nav container-inner group','container'=>'','menu_id' => '','fallback_cb'=> false)); ?></div>
    
    				<div class="container">
    					<div class="container-inner">
    						<div class="toggle-search"><i class="fa fa-search"></i></div>
    						<div class="search-expand">
    							<div class="search-expand-inner">
    								<?php get_search_form(); ?>
    							</div>
    						</div>
    					</div><!--/.container-inner-->
    				</div><!--/.container-->
    
    			</nav><!--/#nav-topbar-->
    		<?php endif; ?>
    
    		<div class="container group">
    			<div class="container-inner">
    
    				<div class="group pad">
    					<?php echo alx_site_title(); ?>
    					<?php if ( ot_get_option('site-description') != 'off' ): ?><p class="site-description"><?php bloginfo( 'description' ); ?></p><?php endif; ?>
    				</div>
    
    				<?php if (has_nav_menu('header')): ?>
    					<nav class="nav-container group" id="nav-header">
    						<div class="nav-toggle"><i class="fa fa-bars"></i></div>
    						<div class="nav-text"><!-- put your mobile menu text here --></div>
    						<div class="nav-wrap container"><?php wp_nav_menu(array('theme_location'=>'header','menu_class'=>'nav container-inner group','container'=>'','menu_id' => '','fallback_cb'=> false)); ?></div>
    					</nav><!--/#nav-header-->
    				<?php endif; ?>
    
    			</div><!--/.container-inner-->
    		</div><!--/.container-->
    
    	</header><!--/#header-->
    
    	<div class="container" id="page">
    		<div class="container-inner">
    			<div class="main">
    				<div class="main-inner group">

    The version available on www.remarpro.com (v1.4.5) does not include an option to load an image in the header, so the header.php file doesn’t inlcude the “<?php if ( ot_get_option(‘header-image’) == ” ): ?>” code. However, this won’t affect the placement of the adbox; it would still go right before the “<?php if ( has_nav_menu(‘header’) ): ?>” line.

    Thread Starter rspisarski

    (@rspisarski)

    okay I got it on there but it is appearing under my logo not next to it. is there a fix for that?

    Try moving the adbox up so it’s between the site-title and site-description lines:

    <div class="container group">
    			<div class="container-inner">
    
    				<div class="group pad">
    					<?php echo alx_site_title(); ?>
    
    <!-- BEGIN Ad Box -->
    <div id="adbox">
    <!-- the code for your ad would go here -->
    </div>
    <!-- END Ad Box -->
    
    				<?php if ( ot_get_option('site-description') != 'off' ): ?><p class="site-description"><?php bloginfo( 'description' ); ?></p><?php endif; ?>
    				</div>
    Thread Starter rspisarski

    (@rspisarski)

    Yes that worked. thank you for the help. I really appreciate it!

    Thread Starter rspisarski

    (@rspisarski)

    I am however having an issue with it mobile. is there a way i can fix that

Viewing 15 replies - 1 through 15 (of 17 total)
  • The topic ‘Add Google Adsense to My Header’ is closed to new replies.