Jump to content
christianmolk

Add Google Adsense To Single Posts

Recommended Posts

christianmolk    0
christianmolk

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
batman    389
batman

Life is too short to remove USB safely ...

Share this post


Link to post
Share on other sites
christianmolk    0
christianmolk

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
batman    389
batman

Hi again

Go to a Page or post

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


Life is too short to remove USB safely ...

Share this post


Link to post
Share on other sites
christianmolk    0
christianmolk

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
batman    389
batman

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".

 

;)


Life is too short to remove USB safely ...

Share this post


Link to post
Share on other sites
christianmolk    0
christianmolk

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
batman    389
batman

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
;)
 

Life is too short to remove USB safely ...

Share this post


Link to post
Share on other sites
christianmolk    0
christianmolk

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
catrina    103
catrina

As a workaround for hiding the ad banner on your front page, you can try hiding them with custom CSS:

 

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

http://w3schools.com/css/css_display_visibility.asp (use display: none)


Please read the docs before posting. Please do not private message me unless I ask you to.

Designer | Catrina Dulay

Founder | Catrina and Mouse

Share this post


Link to post
Share on other sites
christianmolk    0
christianmolk

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
batman    389
batman

Hi again

You can try with

.home .leaderboard { display:none; }


Life is too short to remove USB safely ...

Share this post


Link to post
Share on other sites
christianmolk    0
christianmolk

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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


×