Jump to content

Archived

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

theflightattendantlife

Google Adsense Placement

Recommended Posts

theflightattendantlife
My website is www.theflightattendantlife.com

What [b]I want to do is place Google Adsense Leaderboard Ads in certain places on the different pages.[/b]

[i]The Front Page: [/i]

I want an ad below the features section

For the following pages:

[i]About, Where I've Been, Upcoming Adventures, Inflight Dietitian, Flight Fashion[/i]

I want an ad placed right below the header.

[b]My question is, should I use the callout section, masthead, features...??? to place the code. Just want to know the best way to do this.[/b]

Thanks

Share this post


Link to post
Share on other sites
Danny
Hi,

To position this correctly, you would probably be best using a hook. First thing you should do is go to the PageLines store and install the free plugin called Action Map. Once installed, go to your homepage, refresh your site and in the top left hand side of your Wordpress admin bar, a new link should be visible called Action Map. Clicking this link, will load all the hook locations on your site, this will assist in locating the correct position for you to add your Google Leader-board.

Below is just an example of a hook and will not actually work, you will need to amend the code.

[CODE]
add_action('pagelines_inside_top_branding', 'google_lb_ad');

// function name
function google_lb_ad(){ ?>

Add Google Ad Code Here

}
[/CODE]


You may need to use CSS to style and position the ad correctly.

Please search our forums, before posting!

Share this post


Link to post
Share on other sites
DIYPropertyManager

Hey Danny,

 

I have used the recommended PHP function that you provided in Comment #2 and that works great for a standard desktop browser.  My problem now is when a mobile browser is used, such as that on an iPhone, the adsense ad is not resized.  My assumption would be that I would also need to have a mobile version of the advertisement, but I am not sure how to appropriately switch between the two dependent on the user-agent.

 

 

Any help would be appreciated!

 

- DIY Property Manager

 

http://diypropertymanagement.com

Share this post


Link to post
Share on other sites
James B

Hi there, I'd say check back with google to see if the add has a set width/height in pixels or if there's a code for a responsive version. Usually responsive sizes are done in percentages not set figures such as 300px etc.


Kindly search the forum and read the documentation before posting. It will help you resolve many issues.

For CSS help be sure to check out W3Schools first and be sure to download FireBug for FireFox for troubleshooting.

James B

Share this post


Link to post
Share on other sites
DIYPropertyManager

Google does not provide a responsive advertisement, everything must be taken care of through JS and CSS apparently.  Here is something that I found during a search...

 

 

 

<script type="text/javascript">
    google_ad_client = "ca-publisher-id";
    if (window.innerWidth >= 800) {
        google_ad_slot = "ad-unit-1";
        google_ad_width = 728;
        google_ad_height = 60;
    } else if (window.innerWidth < 400) {
        google_ad_slot = "ad-unit-2";
        google_ad_width = 300;
        google_ad_height = 250;
    } else {
        google_ad_slot = "ad-unit-3";
        google_ad_width = 468;
        google_ad_height = 60;
    }
</script>
<script type="text/javascript" 
 src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>

Share this post


Link to post
Share on other sites
Rob

Your ad (as with all non-mobile Google Adsense) is designed for a static sized view.  You'll note their code includes 728 and 90, which are pixel sizes.  Those ads will likely not resize in Mobile View.

 

Go to Dashboard > PageLines > Site Options > Website Setup and check the box to Disable Mobile View.  Your site will still be fully responsive, yet it will look exactly as it does in a non-mobile computer.


Former PageLines Moderator, Food Expert and Raconteur

Share this post


Link to post
Share on other sites
danielj

Hello. Where do I actually add the code for the hook? In my case, I want to place a google ad in pagelines_before_postloop, and want to add code like this to loop_start (or something like this. It's what I used in the previous version of the site with a completely different theme):

 

<?php while ( have_posts() ) : the_post() ?>
<?php $loopcounter++; if (($loopcounter == 1) || ($loopcounter == 2)) { # 2 ads per page 
?>
<div class="adsense" style="text-align:center;">
What's That Bug? does not endorse extermination<br />
<script type="text/javascript"><!--
google_ad_client = "pub-0148903435359348";
/* 300x250, created 9/14/08 */
google_ad_slot = "6218044538";
google_ad_width = 300;
google_ad_height = 250;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div>

Share this post


Link to post
Share on other sites
Danny

All hooks, are added to your child themes functions.php file.


Please search our forums, before posting!

Share this post


Link to post
Share on other sites
danielj

Thanks again! I didn't do a child theme yet - I added a line at the end of functions.php that calls child_functions.php. That way when I upgrade I just have to remember to add that line back in, but my changes won't get stepped on. I'll tackle child themes at some other point, but this buys me time while I get the site looking closer to the way I want.

Share this post


Link to post
Share on other sites
webmaster021801

Hi there Danny...

 

My website is still based on framework. I am in the process of building a new site in DMS.

 

While that is happening, I have signed up with Google Adsense to display ads on the Pagelines site. Adsense has amended their code to adjust the size of ads in a way that is responsive to differing devices. However, my ads do not adjust.

 

I have removed the ads until I can fix my issue.

 

Info on Adsense indicates that this problem exists and suggests reasons why it might be - https://support.google.com/adsense/answer/3213689

 

I had placed my ad code on my front page via custom code in the Asynchronous Analytics section.

 

I placed a second ad in the side bar via a text widget. All worked fine, except that the size of the ads would not adjust for size on different devices.

 

Would you have some pointers as to what I do about this in Pagelines Framework (and DMS for that matter)?

 

With thanks...

Share this post


Link to post
Share on other sites
Danny

webmaster021801 - What you're using isn't PageLines code, if this isn't working, you will need to provide a link to the site in question, so we can see the issue.


Please search our forums, before posting!

Share this post


Link to post
Share on other sites

  • Similar Content

    • Simon
      By Simon
      Please Note: Recent software such as DMS is not affected by this security advisory.   Three days ago we were alerted by Securi via email that there were a couple of problems with two of our legacy themes, namely PlatformPro and PageLines Framework.
       
      We take security seriously, so we wasted no time updating the free versions of these themes on the WordPress Repo and updating the pro versions over here at pagelines.com
       
      The following versions of the two themes have been patched and are available from your account area right now.
       
      PlatformPro 1.6.2 [download]
      PageLines Framework 2.4.6 [download]
       
      If you are using the free versions of the two themes available on wordpress.org, those files have also been patched.
       
      PageLines 1.4.6 [download]
      Platform 1.4.4 [download]
       
      In all cases you should see an update available in your WordPress admin area and should update right away.
      In the event that you cannot update the theme we took the time to create a small plugin that will protect your site.
      The plugin will work with all versions of both themes, just install and activate it for immediate protection.
       pl-security-patcher.zip
       
       
    • satronen
      By satronen
      I am currently using Pagelines Framework 2.4.6
      I'm interested to upgrade my site to iBlogPro6
      Will I be able to keep my Pagelines Framework website live and uninterrupted while building my new iBlogPro6 site?
      Is there a online help guide of specifics instructions how to get this process started once I download iBlogPro6?
    • satronen
      By satronen
      I am currently using Pagelines Framework 2.4.6
      I'm interested to upgrade my site to iBlogPro6
      Will I be able to keep my Pagelines Framework website live and uninterrupted while building my new iBlogPro6 site?
      Is there a online help guide of specifics instructions how to get this process started once I download iBlogPro6?
    • nandorj78
      By nandorj78+
      Hi,
      My site (fernandosouza.org) currently runs Pagelines Framework. A while ago when DMS was released I had a problem when installing it. Every time I tried I got a blank page whenever I activated it and I couldn't even go back to my adm backend. I always got stuck on a blank page loop. I remember reporting it here back then, but no solution was found.
       
      Anyway, I decided to give it another try now with DMS2. For my surprise, the same thing happened. I activated the theme and got stuck on a blank screen. The only way out to it is to manually delete the theme using a FTP client.
       
      I really would like to have my site running DMS2. Maybe the only way to install it is to manually delete Pageline Frameorks before? (just a guess here)
       
      Anybody knows a solution to this?
       
      By the way, I'm using wordpress 4.0
    • CjrMotley
      By CjrMotley+
      Ok, I'm having problems with my custom post types showing on my front blog page along with my regular blog post, here is a link to the custom post type (sample post) ==> http://www.definitiondjs.com/musiclibrary/this-is-a-post-title-test/ ..... my custom fields doesn't show, Why?
       
      Also, when I edit the custom post, all the fields change to blank (the previous text that was in the field is somehow deleted), why?
       
      Wordpress: 4.0
      Pageline Frameworks: 2.4.5
      cpt plugin is: WCK, here is a link to the site ==> http://www.cozmoslabs.com/docs/wordpress-creation-kit-documentation/
       
      I linked snapshots of the custom fields area, which doesnt show after publishing or after clicking edit this post:
       
      http://www.definitiondjs.com/wp-content/uploads/2014/09/01.png
      http://www.definitiondjs.com/wp-content/uploads/2014/09/02.png
      http://www.definitiondjs.com/wp-content/uploads/2014/09/03.png
       
      Summary, I would like my custom post to display on my front page, along with my blog post.
       
      Also I would like to have an option to hide post from showing on front page, but I would like for all posts to show in search, archieved and category, even if hidden from the front page.
       
      Thanks in advance!
×