Google AdSense Code - Page Level QuickStar

divademochila
Posts: 14
Joined: Tue Dec 06, 2016 4:15 am
Contact:

Google AdSense Code - Page Level QuickStar

Postby divademochila » Wed Mar 15, 2017 2:02 am Supported Until: Thu Jun 01 04:27:58 +1000 2017 | Expired

Hi,
I saw that Google AdSense plugin won't work anymore. So I visited the Google AdSense page, and there's a way to but a general code to manage ads by QuickStart.

But, I need to put on <head> section, or right before <body>. That's impossible, because we know the blog is on wordpress.
I found many tutorials to tell me how to insert ads code on PHP, but didn't work.

Did you know how is teh best way to put this code on main page to work in the hole site?

The code is this:
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<script>
(adsbygoogle = window.adsbygoogle || []).push({
google_ad_client: "ca-pub-2199574885939502",
enable_page_level_ads: true
});
</script>

I tried to creat ad.php and then call on main page by a variable, but didn't work. =/

Thanks in advance.

Best, Margareth.

User avatar
pirateS
Site Admin
Posts: 6254
Joined: Wed Nov 05, 2014 11:49 am
Contact:

Re: Google AdSense Code - Page Level QuickStar

Postby pirateS » Wed Mar 15, 2017 11:54 am

Hi,
Please go to Appearance -> Theme Options -> Advanced Settings -> You will see Custom Code setting there.
One more thing, don't forget to clear cache If you are using a Cache plugin.
Thanks

divademochila
Posts: 14
Joined: Tue Dec 06, 2016 4:15 am
Contact:

Re: Google AdSense Code - Page Level QuickStar

Postby divademochila » Wed Apr 12, 2017 4:00 am Supported Until: Thu Jun 01 04:27:58 +1000 2017 | Expired

Hi, Thanks so much for your help.

Just one more doubt. Is there a way to limit so that the code is not implemented in the home of the site? Inserting in Advanced >> CSS code is inserted throughout the site.

I wanted to limit it so it would not be applied at home. He's messing with the layout, as you can see at divademochila.com.br

Tks in advance.

Best regards, Margareth.

User avatar
pirateS
Site Admin
Posts: 6254
Joined: Wed Nov 05, 2014 11:49 am
Contact:

Re: Google AdSense Code - Page Level QuickStar

Postby pirateS » Thu Apr 13, 2017 1:11 pm

Hi,
Please go to your website -> Right-click ->Inspect ->You should look like this http://nimb.ws/KTaODL Each page has a particular class, that only for the page, for example, We have "home" for the home page, "page-template-page-builder" for the Page Builder Template, or single-post for the single page. And if you want to change the title color for the single page, you should put that particular class before:

CodeColon Select All Code

.single-post .entry-header__title{
color: red;
}

Best regards
Thanks

divademochila
Posts: 14
Joined: Tue Dec 06, 2016 4:15 am
Contact:

Re: Google AdSense Code - Page Level QuickStar

Postby divademochila » Tue Apr 25, 2017 2:39 am Supported Until: Thu Jun 01 04:27:58 +1000 2017 | Expired

Hi,
I think your answer is for another question...

Best, Margareth.

User avatar
pirateS
Site Admin
Posts: 6254
Joined: Wed Nov 05, 2014 11:49 am
Contact:

Re: Google AdSense Code - Page Level QuickStar

Postby pirateS » Thu Apr 27, 2017 4:35 am

Hi <br />
Sorry, I'm missing.
We will use Child-theme to do that. Please the following steps:
1. Go to Appearance -> Themes -> Activate Hermes Child Theme
2. Click on Appearance -> Editor -> A list files of the theme will be shown on te right, looking for functions.php -> Click on it (It means we want to work on functions.php file)
3. Put the below code to the bottom of the file

CodeColon Select All Code

   add_action('wp_footer', 'wiloke_hermes_child_scripts');
   function wiloke_hermes_child_scripts(){
      if ( is_home() || is_front_page() ){
         return false;
      }
      ?>
      <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
      <script>
      (adsbygoogle = window.adsbygoogle || []).push({
      google_ad_client: "ca-pub-2199574885939502",
      enable_page_level_ads: true
      });
      </script>
      <?php
   }

Voetzoekers
Posts: 44
Joined: Sun Oct 29, 2017 10:40 pm
Contact:

Re: Google AdSense Code - Page Level QuickStar

Postby Voetzoekers » Tue Nov 21, 2017 7:36 pm Supported Until: Sun Apr 29 18:39:52 +1000 2018

pirateS WroteColonHi <br />
We will use Child-theme to do that. Please the following steps:
1. Go to Appearance -> Themes -> Activate Hermes Child Theme

[/code]


Already lost me on the first step there. I wanted to add/enable the child theme so I could start trying to add some custom CSS.
But when I go to:
Appearance --> Themes -->
There is no ' Activate Hermes Child Theme' there.

Question 1:
Is this a feature that had been disabled recently?

Question 2:
Am I missing something?

Question 3:
If this feature is no longer there is it recommended using a plugin like:
https://wordpress.org/plugins/child-theme-configurator/

Edit:
I will create a new post, think that its better that way for any future references.

User avatar
adiazudin
Posts: 43
Joined: Sun May 28, 2017 9:32 am
Location: Kuala Lumpur
Contact:

Re: Google AdSense Code - Page Level QuickStar

Postby adiazudin » Wed Nov 22, 2017 1:00 am Supported Until: Sat Nov 11 11:53:10 +1100 2017 | Expired

divademochila WroteColonHi,
I saw that Google AdSense plugin won't work anymore. So I visited the Google AdSense page, and there's a way to but a general code to manage ads by QuickStart.

But, I need to put on <head> section, or right before <body>. That's impossible, because we know the blog is on wordpress.
I found many tutorials to tell me how to insert ads code on PHP, but didn't work.

Did you know how is teh best way to put this code on main page to work in the hole site?

The code is this:
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<script>
(adsbygoogle = window.adsbygoogle || []).push({
google_ad_client: "ca-pub-2199574885939502",
enable_page_level_ads: true
});
</script>

I tried to creat ad.php and then call on main page by a variable, but didn't work. =/

Thanks in advance.

Best, Margareth.


Hi Margareth,
AdSense Page level-ads must put on Header.php

CodeColon Select All Code

<!DOCTYPE html>
<html <?php language_attributes(); ?> class="no-js">
<head>
    <?php wiloke_hermes_favicon(); ?>
    <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 if ( is_singular() && pings_open( get_queried_object() ) ) : ?>
        <link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>">
    <?php endif; ?>

    <?php wp_head(); ?>

    <!-- PAGE LEVEL ADS -->
    <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
    <script>
      (adsbygoogle = window.adsbygoogle || []).push({
        google_ad_client: "ca-pub-xxxxxxxxxxxxxxx",
        enable_page_level_ads: true
      });
    </script>
    <!-- END / PAGE LEVEL ADS -->

</head>
Adi, Designer

User avatar
pirateS
Site Admin
Posts: 6254
Joined: Wed Nov 05, 2014 11:49 am
Contact:

Re: Google AdSense Code - Page Level QuickStar

Postby pirateS » Fri Nov 24, 2017 3:34 am

Hi,
We recommend adding your custom code to APpearance -> Theme Options -> Advanced Settings -> Custom Javascript code. Note that you have to get rid of

CodeColon Select All Code

<script></script>


I mean

CodeColon Select All Code

Mycode


instead of

CodeColon Select All Code

<script>
Mycode
</script>


Thank @y adiazudin


Return to “Hermes”

Who is online

Users browsing this forum: No registered users and 1 guest