Archived

This topic is now archived and is closed to further replies.

  • 0

Add Google Adsense To Single Posts

Question

Posted · Report post

I would like to add Google AdSense to all my Single posts between the text and the comments, but I do not know where to put the code? And how do I avoid this code to be overwritten every time Pagelines is updated?

 

My website is www.christianmolk.se and I do not use any Child theme, just the standard Pagelines Framework. 

Share this post


Link to post
Share on other sites

12 answers to this question

Posted · Report post

Hi

You go to

http://www.pagelines.com/wiki/How_to_Use_the_PageLines_Customize_Plugin

And the youtube on it, here is to see

http://www.youtube.com/watch?v=Z_aorAvL84g&feature=player_embedded#!

 

I give you an other rob´s tutorial (it is a reply at forum)

 

Okay, we'll look at this first piece of code from the tutorial:

add_action('brandnav_after_nav', 'brandnav_icons');
function brandnav_icons() { ?>
<ul>
<li><a href="http://www.facebook.com/mysite"; target="blank"><img src="http://www.mysite.com/wp-content/themes/pagelines/sections/branding/facebook.png"></a></li>;
<li><a href="#"><img src="http://www.mysite.com/wp-content/themes/pagelines/sections/branding/twitter.png"></a></li>;
</ul>
<?php }

 

Notice this first part:

add_action('brandnav_after_nav', 'brandnav_icons');

function brandnav_icons() { ?>

 

brandnav_after_nav is the hook. This is what determines where your desired content is placed. It's pretty easy to understand since hooks are named accordingly. In this case, brandnav_after_nav means that the content you place in this hook will be placed after the brand navigation. Does that make sense?

 

brandnav_icons is the name given to the content you want to add. You can name it however you'd like, but it's best to give it a descriptive name so that you know what it's for. This name is supposed to go in two places (as shown in the code above).

 

 

I suppose that you can try something like  

Add the following code to Dashboard > Plugins > Editor in the PageLines Customize plugin, inside the functions.php file:

 



add_action('pagelines_loop_after_post_content', 'google_leaderboard_ad'); 
// function name 
function google_leaderboard_ad(){ ?> <div class="leaderboard"> ADD YOUR Custom Ad Code here </div> <?php } 
// end function

 

Please take care, you read my sign below
;)
 

Share this post


Link to post
Share on other sites

Posted · Report post

Share this post


Link to post
Share on other sites

Posted · Report post

Thank you for the quick reply batman!

 

I have installed and activated the Action Map plugin but I do not see the button on the left hand side of my WordPress admin bar. 

Share this post


Link to post
Share on other sites

Posted · Report post

Hi again

Go to a Page or post

Captura%2520de%2520pantalla%25202012-12-

Share this post


Link to post
Share on other sites

Posted · Report post

Yes, I see the Action Map button on your picture but it is simply not there on my Wordpress admin bar. This is very strange since I have both installed and activated the plugin. 

Share this post


Link to post
Share on other sites

Posted · Report post

Hi 

I don´t know what happened, please clean your cache....

 

but you can use this hook (it´s only and example)

 

pagelines_loop_after_post_content

 

You can see this Danny´s reply for more information (the second reply)

 

http://www.pagelines.com/forum/topic/22805-google-adsense-placement/?hl=hook#entry132874

 

Perhaps you need  wait a professional answer for "The Moderating Team".

 

;)

Share this post


Link to post
Share on other sites

Posted · Report post

I used the code you wrote and it worked almost perfectly! The only issue I have now is how to not show my Google Ads on the front page. Is there any more code to ad to make this happen?

Share this post


Link to post
Share on other sites

Posted · Report post

I tried using the code ".home #ads {display:none;}" but it did not do anything. Any ideas?

Share this post


Link to post
Share on other sites

Posted · Report post

Thanks for your answers batman. If I am to use these "hooks", how do I locate them and where do I put the Google AdSense code?

Share this post


Link to post
Share on other sites

Posted · Report post

Hi again

You can try with

.home .leaderboard { display:none; }

Share this post


Link to post
Share on other sites

Posted · Report post

Thank you batman! That actually worked just as I wanted it to!  :thumbsu:

Share this post


Link to post
Share on other sites