Add Google Adsense Link Unit In Header

Dinesh Jain edited this page Jan 17, 2016 · 1 revision

Majority of bloggers and other content based sites rely on Google Ad-sense for generating revenues through their websites. And it's a good practice to blend the Google ads with the site's content.

Here, in this post, we will be demonstrating the addition of Google Ad-sense Link unit in the header section of the rtPanel child theme, which looks some thing like we have done in the Devils' Workshop.

All you need to do is,

In the rtPanel child theme, you will find the 'lib' directory. Open the rtp-custom-hooks-applied.php file in the 'lib' directory and create a function something like:

function rtp_google_ad_link_header() {
  $google_ad_unit = '  [ADD YOUR SNIPPET FOR THE GOOGLE AD LINK UNIT HERE]  ';
  echo $google_ad_unit;
}

Next, we create the action at the appropriate hook. Going specific to the current topic, we want the Google Ad Link Unit to be added up in the header section after the logo. So I proceed as:

add_action('rtp_hook_after_header','rtp_google_ad_link_header',1);

There it is! We have successfully added the Google Ad Link Unit in the header. Further blending with the content can be easily handled using CSS.

For any doubt about adding Google Ad Link Unit to your rtPanel theme, ask your questions on our support forum.

Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.