• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

Ads in grid style

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › Design Tips and Tricks › Ads in grid style

This topic is: not resolved

Tagged: ad, ads, adsense, css, grid, layout, Metro Pro, Wordpress

  • This topic has 11 replies, 2 voices, and was last updated 8 years, 11 months ago by viorelepuran.
Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • March 3, 2014 at 2:36 am #93152
    viorelepuran
    Member

    Hello guys,
    I am using a child theme with genesis, and i created a category.php to display post in grid layout.
    So now, my post are beeing displayed on 2 columns.
    Now i want to add a adsense ad after the first 6 posts.
    So it needs to be 6 posts, and after those 6 posts, a area as width as the 2 column post, containing the AD.
    Here is the file for category, in pastebin
    http://pastebin.com/wxzBMUpt
    I think it needs some tweeks on line 13 , but i do not know how to do it.
    Can someone help me with it?
    I saw a example from someone, but i think it is not for grid style.Here it is:

    Ah! Now I understand. Try replacing:

    <?php
    if (have_posts()) : while (have_posts()) : the_post();
    get_template_part('post', 'homepage');
    endwhile;
    with:

    <?php
    if (have_posts()) : $c = 0; while (have_posts()) : the_post();
    $c ++;
    get_template_part('post', 'homepage');
    if ($c > 2 ) {
    $c = 0;?>
    [ insert ad code here ]
    <?php
    }
    endwhile;

    Here you can see how the end result should look like.

    http://postimg.org/image/qlawdlyc7/

    Thank you !

    http://test.sneakerbardetroit.com/
    March 3, 2014 at 2:47 am #93153
    Brad Dalton
    Participant

    Please paste all the code in a Github Gist and embed the Gist here. Thanks


    Get Help – Book Consultation.

    March 3, 2014 at 2:50 am #93154
    viorelepuran
    Member

    Hy brad, thank you for your reply.
    I did as you told me to do.Please tell me if the code from category.php is enough, or if you need something else.
    <script src="https://gist.github.com/anonymous/9320928.js"></script>

    March 3, 2014 at 3:01 am #93158
    viorelepuran
    Member

    Why can i not embed the Gist here?
    Can you see the code?

    March 3, 2014 at 3:11 am #93161
    viorelepuran
    Member
    March 3, 2014 at 5:25 am #93170
    Brad Dalton
    Participant

    Try the clone link.


    Get Help – Book Consultation.

    March 3, 2014 at 5:26 am #93171
    viorelepuran
    Member

    is this ok?

    March 3, 2014 at 5:45 am #93173
    viorelepuran
    Member

    Yes, it is ok now.
    Do you have any ideea of how to place a ad after the 6th post, like shown in the bellow image?
    http://postimg.org/image/qlawdlyc7/

    March 3, 2014 at 6:41 am #93175
    Brad Dalton
    Participant

    Change the 1 in the code to a 6 http://wpsites.net/web-design/add-content-after-any-number-of-post-excerpts-in-any-type-of-archive/


    Get Help – Book Consultation.

    March 3, 2014 at 7:35 am #93190
    viorelepuran
    Member

    Thank you for your effort. I tried all 4 codes on the link you gaved me, but only the las one seems to work for me.
    The thing is that it replaces the 6th post excerpt withe the add.I need it to place the ad bellow excerpt, and to be as whidth as the 2 columns. I think the first code, with black background would work, but maybe i am doing something wrong...
    Can you please look again at that code?
    Here is the link with the working last code
    http://test.sneakerbardetroit.com/

    March 3, 2014 at 8:23 am #93195
    Brad Dalton
    Participant

    I tested all of them and they all work perfectly.

    I also tested this solution on a HTML 5 theme using the grid loop on the home page with this code and i know for a fact it works.

    https://gist.github.com/braddalton/617807f3310b87ded754


    Get Help – Book Consultation.

    March 3, 2014 at 8:26 am #93197
    viorelepuran
    Member

    It does not works...would it help you if i gave you access to ftp and wp-admin?

  • Author
    Posts
Viewing 12 posts - 1 through 12 (of 12 total)
  • The forum ‘Design Tips and Tricks’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2023 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble