How to add advertisement code between category blog layout m

Rate this topic: Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.1.00 out of 6 based on 1 vote(s)
GK User
Fri Nov 18, 2016 2:35 am
Reply with quote
Report this post
Hi,

I am using category blog layout for my menu item. Now I want to add advertisement codes between articles displayed in a menu item. Can you tell me how to do?

mobile view.jpg


desktop view.jpg


Please see attache scrennshot for reference.

Thank you and regards,

Hai
User avatar
Gold Boarder

teitbite
Tue Nov 22, 2016 10:04 am
Reply with quote
Report this post
Hi

Easiest would be to use a javascript to move adverts into this place. Other option would be to hack the code of category layout, not the most pleasant solution.

Try add some adverts to a custom html module with module class suffix " adverts", publish it on the page You need it and tell me the url I'll be able to see it.
User avatar
Moderator

GK User
Tue Nov 22, 2016 1:41 pm
Reply with quote
Report this post
Hi Teitbite,

I already sent you admin accout via private message.

What I need is to add ads to the place like following screenshot.

Ads position.jpg


Thank you a lot and look forwards to hearing from you.

Hai
User avatar
Gold Boarder

teitbite
Tue Nov 29, 2016 12:17 pm
Reply with quote
Report this post
Hi

I've used this small script in /layout/blocks/head.php

Code: Select all
<script type="text/javascript">(function($) {$(document).ready(function() {
if( $('.blog div[itemprop="blogPost"]').size() > 0 ) {
   var advno = 1;
   var rowno = 1;
   var colno = 1;
   $('#gkFooterArea .custom a').each(function(){
      switch(advno) {
         case 1:
            rowno = 1;
            colno = 1;
          break;
         case 2:
            rowno = 1;
            colno = 2;
          break;
         case 3:
            rowno = 2;
            colno = 1;
          break;
         case 4:
            rowno = 2;
            colno = 2;
          break;
         case 5:
            rowno = 3;
            colno = 1;
          break;
         case 6:
            rowno = 3;
            colno = 2;
          break;
         case 7:
            rowno = 4;
            colno = 1;
          break;
         case 8:
            rowno = 4;
            colno = 2;
          break;
         case 9:
            rowno = 5;
            colno = 1;
          break;
         case 10:
            rowno = 5;
            colno = 2;
         break;
      }

      advno++;
      $('.blog .items-row:nth-child('+rowno+') div[itemprop="blogPost"]:nth-child('+colno+')').append( $(this) );
   });
}
});})(jQuery)</script>
User avatar
Moderator

GK User
Tue Nov 29, 2016 4:40 pm
Reply with quote
Report this post
Hi Teitbite,

Thank you a lot for your kind brainstorming. Can you tell me where to put these codes? for example after the this line "defined('_JEXEC') or die;" or which line?

and also, if I want to add following ads codes between articles in the menu:

-------------

<script type="text/javascript">
goggle_ad_client = "ca-pub-8002591022410923";
goggle_ad_slot = "7847691968";
var w = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
if(w>=970){
goggle_ad_width = 970;
goggle_ad_height = 90;
} else if(w>=728) {
goggle_ad_width = 728;
goggle_ad_height = 90;
} else {
goggle_ad_width = 320;
goggle_ad_height = 100;
}
</script>
<script type="text/javascript" src="//pagead2.gogglesyndication.com/pagead/show_ads.js">
</script>

------------

Where will I put them?

Yours sincerely,

Hai
User avatar
Gold Boarder

GK User
Thu Dec 01, 2016 5:31 am
Reply with quote
Report this post
Hi Teitbite,

I see the ads in these menu item like http://hungtam.com/thai-giao?start=16

But I still don't know how to add other ads, like to add this one:

<script type="text/javascript" src="http://js.Goggle.com/t/106/078/a1106078.js"></script>

Can you help me to explain more?

Thank you,

Hai
User avatar
Gold Boarder

teitbite
Tue Dec 06, 2016 11:23 am
Reply with quote
Report this post
Hi

Google Ads code should go to the very bottom of /layout/blocks/head.php

My script takes all the links (banners) from $('#gkFooterArea .custom a'), so basically adds You've placed in footer. Not sure what google ads will produce in this place, adjustment to the script's selector may be needed. Try add this advs so I'll be able to check what change is required.
User avatar
Moderator

GK User
Thu Dec 08, 2016 11:19 am
Reply with quote
Report this post
Hi Teitbite,

I am asking Piotr to help me with this issue in the VIP support as he helped me to arrange the display of "blog layout" menu item too.

Thank you a lot,

Hai
User avatar
Gold Boarder

teitbite
Fri Dec 09, 2016 11:03 am
Reply with quote
Report this post
Hi

I know :) I'm Piotr. Lets just keep conversation in VIP tickets. Will be easier no to divide attentions between both this sources. Closing this thread than.
User avatar
Moderator


cron