Jump to content


Photo
- - - - -

Adsense Displayed on Home Page, First Two Posts Only


Best Answer Rob , 06 January 2013 - 07:25 PM

Manoj

 

I understand your frustration, but please understand this request is an extreme customization.  It is very easy for us to provide, via the forum, the mechanism to add Google AdSense code to your site.  But to have the code inserted so that it displays on specific posts is something you really must hire a professional developer for.  It is not something we can assist with for the simple reason that you're talking about something to do with the management of the loop, not the design or layout of the site.  Since this is a WordPress issue, i'm compelled to refer you to our Pros.

 

Also, I realize you're not going to be pleased with that recommendation, so I'll respectfully suggest in that case, modification of your requirement so that the ads can display on a global basis, as WordPress is designed.  Again, this isn't a limitation placed by PageLines, but it is also something we can't support.  Nonetheless, one of our professionals may be able to assist, or another pro developer familiar with the WordPress loop might be helpful.

Go to the full post


  • Please log in to reply
15 replies to this topic

#1 onlinetracker

onlinetracker

    Super Member

  • Members

  • 154 posts
  • Country: Country Flag

Posted 29 December 2012 - 05:41 PM

There have been a lot of examples of code for displaying advertisements in WordPress. I can't seem to get them to work within the functions.php/framework configuration. I'm a noob so wouldn't mind someone explaining it like I'm five.

 

Plugins I have found didn't display advertisements on the home page/blog page, only on posts.

If someone knows of a plugin that will allow this, even better.

 

Right now I have a function/hook that is displaying under every excerpt and that doesn't look good when google only displays 3 adverts and my tower isn't being displayed.

 

Thanks



#2 Simon_P

Simon_P

    Messer

  • Administrators



  • 8388607 posts
  • LocationDevon
  • Framework Version:2.1.1
  • Country: Country Flag

Posted 29 December 2012 - 06:21 PM

Install free action map plugin to get a visual map of all the hook locations then get the hooker plugin to add your hooks.
Be the best few dollars ever spent trust me ;)

#3 onlinetracker

onlinetracker

    Super Member

  • Members

  • 154 posts
  • Country: Country Flag

Posted 29 December 2012 - 06:42 PM

@Simon_P

 

Thanks for the quick reply. I've installed the Action Map plugin, great idea but I think my build is conflicting with the plugin. I have BBPress and BuddyPress installed as well as the White Label CMS plugin which removes the WordPress logo from the top left of the screen. The Action Map plugin says that the on/off function is in the top left, so I'm not sure if that is where it would normally drop down or not.

 

Edit: So, I disabled the WhiteLabelCMS Plugin which didn't make any option for ActionMap appear.

Edit2: ugh... As par for the course, I used the Pagelines Store to download the plugin which threw it into the plugins directory but doesn't automatically activate it and I didn't go into the plugins directory to activate it, so of course, no function. derp.



#4 Simon_P

Simon_P

    Messer

  • Administrators



  • 8388607 posts
  • LocationDevon
  • Framework Version:2.1.1
  • Country: Country Flag

Posted 29 December 2012 - 06:46 PM

It adds a button to the normal wp admin menu bar

#5 onlinetracker

onlinetracker

    Super Member

  • Members

  • 154 posts
  • Country: Country Flag

Posted 29 December 2012 - 07:37 PM

Ah, I guess I'll keep looking. All these two things do is point to where something should go, but the code I've seen everywhere doesn't seem to work within the functions.php customization plugin, at least, not as is. So, it isn't so much as where something should go, but what needs to go where.



#6 Rob

Rob

    One Smart Egg

  • Members
  • 13575 posts
  • LocationEast Coast, USA
  • Framework Version:The Latest, of course
  • Country: Country Flag

Posted 29 December 2012 - 09:09 PM

Action Map plugin was intended to help you identify the location of anything you wish to modify in a post/page layout.

 

Simon also mentioned the Hooker Plugin, a new premium product, which allows you to select the hooks from a drop down list, then paste code that's to be added to that hook. Hooker then writes the customized code correctly, for you. Once the hook is written, you can disable Action Map plugin entirely.

 

The question of what needs to go where is not quite as enduring as the mysteries of the Pyramids, but it's getting there!  Depending on what you're hoping to add, if you have the code, Hooker provides you the chance to simply paste it and go.  It's perfect, for example, for ads going into the header's branding section or contact info with linked phone numbers.

 

As for the display of ads on the first two posts only,  being an Adsense publisher for more than a decade, I'm unclear why you'd want to do this.  Adsense depends on several factors, including views and impressions.  The more views; the more likely you'll get impressions. This is your conversion rate.  These are usually very small, often fractions of one percent.  You really don't want to limit the opportunities for visitors to see your ads.

 

My recommendation is to place at least two Adsense code instances (the maximum allowed is three) on each and every page or post, above the fold (meaning, before the visitors have to scroll down).  One in the header's Branding area (a leaderboard works nicely here) and in the sidebar, a 336px wide ad is very effective.



#7 onlinetracker

onlinetracker

    Super Member

  • Members

  • 154 posts
  • Country: Country Flag

Posted 29 December 2012 - 09:25 PM

I honestly can't figure out how to respond to being sold on a plugin that doesn't answer my question, and then a remedial adsense course that asks why I would want to only put an advertisement under the first two posts and then answers it in the very next paragraph. It is like you two aren't reading the inquiry. I know what I want to do. I know where it should go. The way that Pagelines Framework is set up is keeping me from injecting the code that counts the first two entries and puts an advertisement under the excerpt. That's it. I can do it on the default WP install and theme... can't do it on Pagelines Framework. That is why I came to the forums to see if anyone has experience in doing such, but I'm being sold on a plugin. Oh well.



#8 Danny

Danny

    Is Awesome!

  • Moderators
  • 17124 posts
  • LocationManchester, UK
  • Country: Country Flag

Posted 30 December 2012 - 11:08 AM

As you probably know PageLines isn't setup like an ordinary Wordpress theme. If you wish to insert adsense onto your homepage and the first two posts, you will need to follow the instructions provided by Simon and use the ActionMap plugin to identify the correct location.

 

Please Login or Register to see this Hidden Content



#9 manojgupta26

manojgupta26

    Super Member

  • Members
  • 144 posts
  • Country: Country Flag

Posted 30 December 2012 - 07:06 PM

It would be great if can share the hook and function...I already tried all the available hooks for that location..but it doesn't work. I raised similar issue few months back and all I got an answer was...contact pageline pros. At least the framework must provide all the features that basic installation of wordpress provides.

 

Quick help is appreciated!



#10 Simon_P

Simon_P

    Messer

  • Administrators



  • 8388607 posts
  • LocationDevon
  • Framework Version:2.1.1
  • Country: Country Flag

Posted 30 December 2012 - 07:56 PM

Do a search for Adsense and you will find a post I replied to with some code to put Adsense in the first post only, it can be adapted I'm sure.

#11 manojgupta26

manojgupta26

    Super Member

  • Members
  • 144 posts
  • Country: Country Flag

Posted 31 December 2012 - 04:03 PM

Simon, i don't want to use any plugins..I already cleared in my query ...



#12 Rob

Rob

    One Smart Egg

  • Members
  • 13575 posts
  • LocationEast Coast, USA
  • Framework Version:The Latest, of course
  • Country: Country Flag

Posted 31 December 2012 - 09:55 PM

Manoj,

 

The Action Map plugin is intended solely to identify the location of things in posts or pages. It is a development tool, not a plugin for the placement of Adsense code. Kindly understand we're trying to help you with this issue and not to push plugins.  If you don't wish to use it, you're more than welcome to source through thousands of lines of code to find the correct place. Action Map makes it easier.

 

The Hooker Plugin is a very inexpensive means of saving you a great deal of time and trouble implementing your Adsense code, once the hook is identified.  Again, no one's forcing or pushing you to use or purchase anything,  but we're offering you solutions.  I'm unsure why you're unhappy with these suggestions, but you're more than free to do things manually with the child theme or pagelines-customize functions.php file.

 

We do want you to be a happy customer.



#13 manojgupta26

manojgupta26

    Super Member

  • Members
  • 144 posts
  • Country: Country Flag

Posted 01 January 2013 - 12:41 PM

When did I said I don't intend to use Action Map plugin? I said I already tried but could not identify the right hook. This was the solution you suggested - which requires two plugins. 

 

But I do not want to use these two plugins..

 

 

 

In cases such as this, I'm afraid such a customization takes the help of a Pro because trying to break into the loop can cause harm to your site.  So, I'd refer you to 

Please Login or Register to see this Hidden Content

 

On the flip side of that, What I have done in past is to use 

Please Login or Register to see this Hidden Content

 and the 

Please Login or Register to see this Hidden Content

.  This would allow you to emulate the loop using customized shortcode you create yourself and some easy CSS.   Both plugins are free, but have premium versions at CodeCanyon.net.

 

Place Special Recent Posts shortcode on a static homepage for the 1st two posts. You may have to use CSS to resize the thumbnail, but it's very easy to do. 

 

Below it, using the Boxer plugin, which creates content blocks, insert the shortcode for a block-set.    The block set has one box, and it contains the AdSense code.

 

Following this, more shortcode for Special Recent Posts, this one offsetting the post list by 2, and displaying 8 or whatever number you'd like.

 

So, the page would have

  • 2 posts
  • ad
  • 8 posts

 

That seemed to be the layout you were seeking.

 

Note: If you were going to style the ads, such as centering, you can still do so with the content block.  Simply wrap the code in a unique class and use CSS to align the ad as desired. You may also be able to achieve this with the settings of Boxer plugin.

 

 


#14 Simon_P

Simon_P

    Messer

  • Administrators



  • 8388607 posts
  • LocationDevon
  • Framework Version:2.1.1
  • Country: Country Flag

Posted 01 January 2013 - 02:23 PM

As I mentioned earlier, this post is almost the same and you could easily adapt the code: 

Please Login or Register to see this Hidden Content


 
In that example the user required the adsense to only be displayed on the 2nd post, but you want it on post 1,2 and 3 so you just need to change the math..



Please Login or Register to see this Hidden Content

 



#15 manojgupta26

manojgupta26

    Super Member

  • Members
  • 144 posts
  • Country: Country Flag

Posted 02 January 2013 - 05:09 AM

but this function doesn't do anything when added in functions.php (in pagelines customize plugin).

 

Simon, we would appreciate if you can tell us how to show ads after two post (or three or four and so on) excerpts on homepage. 

 

Thank you!



#16 Rob

Rob

    One Smart Egg

  • Members
  • 13575 posts
  • LocationEast Coast, USA
  • Framework Version:The Latest, of course
  • Country: Country Flag

Posted 06 January 2013 - 07:25 PM   Best Answer

Manoj

 

I understand your frustration, but please understand this request is an extreme customization.  It is very easy for us to provide, via the forum, the mechanism to add Google AdSense code to your site.  But to have the code inserted so that it displays on specific posts is something you really must hire a professional developer for.  It is not something we can assist with for the simple reason that you're talking about something to do with the management of the loop, not the design or layout of the site.  Since this is a WordPress issue, i'm compelled to refer you to our

Please Login or Register to see this Hidden Content

.

 

Also, I realize you're not going to be pleased with that recommendation, so I'll respectfully suggest in that case, modification of your requirement so that the ads can display on a global basis, as WordPress is designed.  Again, this isn't a limitation placed by PageLines, but it is also something we can't support.  Nonetheless, one of our professionals may be able to assist, or another pro developer familiar with the WordPress loop might be helpful.