• Resolved fpandjic

    (@fpandjic)


    I’m trying to add responsive adsense to homepage. None of the plugins are able to insert ads anywhere on homepage, so I have to do it with code.

    I want to insert adsense or banner right between homepage featured slider and posts. Has anyone done it already?

Viewing 7 replies - 1 through 7 (of 7 total)
  • Hi fpandjic. You could insert a new div with your adsense code in index.php and style it using css. Or, this post describes how to do it using a widget. Either way, your code would go between these two lines in index.php:

    <?php get_template_part('inc/featured'); ?>
                                           <==========
    <?php if ( have_posts() ) : ?>

    You should be using a child theme. If you’re not, you can download one from the author’s web site.

    Thread Starter fpandjic

    (@fpandjic)

    Thank you! It is actually pretty easy when you know where you have to put the code ??

    Created additional widget area and added this code where you said it needs to go.

    <?php dynamic_sidebar(‘widget-area’); ?>

    Thread Starter fpandjic

    (@fpandjic)

    Need a little more help with styling. I want to separate adsense banner from posts by putting margin. However, I tried but it looks like it’s not working.

    This is the code I used in style.css, but I’m not very familiar with coding. My widget ID is .adsense
    .adsense {margin-bottom: 20px;}

    Can you post a link to your site?

    Thread Starter fpandjic

    (@fpandjic)

    Click here.

    The container created for the widget has a name different from the sidebar. Try this css:

    .home #text-7.widget {
      margin-bottom: 20px;
      }
    Thread Starter fpandjic

    (@fpandjic)

    It works now! Thanks ??

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Banner/Adsense between slider and posts’ is closed to new replies.