• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

WP SITES

2784

Original Genesis Tutorials & 6000+ Guaranteed Code

Snippets

  • Consultation
  • Full Access
  • Log in

Display Ads After Specific Paragraph on Single Posts

Displaying different types of advertisements within the content area of your blog posts can be achieved using several methods.

According to the experts, placing the ads on the top left hand corner of your posts or after the first paragraph converts the best.

This is not something you may want to do because the ads can be far too random and may imply endorsement of products and services which you don’t use or recommend.

However, if you have bills to pay then Adsense or other types of banner and text ads can convert well when displayed within content that is related to the banner or text advertisement.

Theme Specific Locations

Genesis theme framework users can easily display ads using genesis hooks in a custom function or using the Genesis Simple Hooks plugin.

Before and after posts content hooks are the most popular but what if you want your ads to automatically display after a specific paragraph?

You’ll need a custom function which you’ll find in the code snippet below or on Github.

Display Ads After Specific Paragraph

Note: This code may need modifying depending on exactly where you want to display your ads after a paragraph in respect of the margins and padding.

Register for full access

Related Tutorials

  • Customize Archive Template For Genesis With Ads Before or After Each Entry
  • Insert Different Ads After Every Entry Using Custom Archive Page Template
  • Add Adsense After 1st Paragraph On Single Posts & Pages
  • Display Featured Image Within Content on Single Posts
  • Add New Widget After 1st Post On Home Page
  • Code To Add Widget Inside Body of Content in Any Theme

The Content

Reader Interactions

Comments

  1. Santiago says

    November 4, 2014 at 6:10 pm

    Just what i needed!!! Do you know how to put ads after the 2 first posts in the home? I see tutorials about this, but all of them puts ads EVERY 2 or 3 posts, i mean, repeteadly… Thanks and sorry for my bad english…

    Log in to Reply
    • Brad Dalton says

      November 4, 2014 at 6:14 pm

      Yes but answers for members only

      Log in to Reply
  2. Lisette says

    June 15, 2014 at 6:15 am

    Hi Brad! This is awesome!

    Is there a way we can modify this so that it only appears on wp_mobile? I currently have an ad appearing only in mobile before the content area using Genesis Simple hooks, but I would love to use this method in functions.php instead.

    Any ideas? Thanks!

    Log in to Reply
    • Brad Dalton says

      June 15, 2014 at 6:27 am

      Hello Lisette

      You could try replacing the conditional tag after the function with a line like this:

      Source code https://core.trac.wordpress.org/browser/tags/3.6/wp-includes/vars.php#L106

      Log in to Reply
      • Lisette says

        June 15, 2014 at 12:02 pm

        That’s what I was thinking, but I didn’t want to take my site down due to an error in writing the conditional.

        I tried that verbatim on a test site and it took down the site. I replaced && with && and it was up again, although I’m not sure that was the reason I had an error.

        In any case, you’ve solved an issue I’ve been wrestling with for two days. Thanks so much, Brad!

        Log in to Reply
        • Brad Dalton says

          June 15, 2014 at 5:50 pm

          I think you understand that was caused by the embed not displaying correctly right?

          I’ve updated the code now.

          Log in to Reply
  3. Sandeep says

    April 13, 2014 at 5:28 pm

    hey Brad,

    Thanks for this awesome trick. I already started using this on my website. If possible can you tell me a way so that I can have two 300by300 adsense ad blocks side by side.

    my website is thegeekdiary.com

    Thanks again.

    Log in to Reply
    • Brad Dalton says

      April 13, 2014 at 6:43 pm

      Here’s 2 ways you can try Sandeep:

      http://wpsites.net/web-design/genesis-split-sidebars/
      http://wpsites.net/web-design/split-widgets-5050-side-by-side/

      Log in to Reply
  4. Shashank Bhattarai says

    February 1, 2014 at 2:53 am

    Hello, After post ads implementation is not working in my website. I need to fix it . If you can show me the correct codes.I am using latest version of genesis framework. I tried to implement adding these piece of code in function.php by creating widgers. Check out please ..if there is any error in the code.

    add_action( 'genesis_after_post_content', 'child_after_post_content_ad', 9 );
     function child_after_post_content_ad() {
     if ( is_single() && is_active_sidebar( 'after-post-content-ad' ) ) {
     echo '';
     dynamic_sidebar( 'after-post-content-ad' );
     echo '';
     }
     }
    Log in to Reply
    • Brad Dalton says

      February 1, 2014 at 6:34 am

      This is the correct code to use for sites running HTML 5 child themes:

      add_action( 'genesis_entry_footer', 'after_entry_widget', 1  ); 
      function after_entry_widget() {
      
          if ( ! is_singular( 'post' ) )
          	return;
      
          genesis_widget_area( 'after-entry', array(
      		'before' => '<p class="after-entry">',
      		'after'  => '</p>',
          ) );
      }

      Change the genesis_entry_footer hook to genesis_after_post_content if using the old XHTML markup in your child theme.

      Log in to Reply
  5. Emeka says

    December 4, 2013 at 9:13 am

    Hi Brad,

    This is what I have been looking for and I must say “Thank You” for providing this code. However, could you help me with a modification for how to make the ads appear on single posts but after 2 different paragraphs e.g: after paragraph 2 and 4 of single posts? I’ll be happy to receive a mail from you if you don’t want to share it here.

    Many thanks

    Log in to Reply
  6. sandra says

    November 8, 2013 at 2:00 pm

    Hi and thanks for this insight. I am on the verge of buying genesis with child theme but need to know if genesis will allow for the placement of the 728 x 90 text ad inside the content?

    This is a good size for what I’m looking to do with adsense but having a hard time finding the specific answer.

    Keep up the good work!

    Log in to Reply
    • Brad Dalton says

      November 9, 2013 at 12:13 am

      Yes. You can hook it in conditionally or create a widget area for the banner.

      The banner will display according to the content width.

      Log in to Reply
      • sandra says

        November 9, 2013 at 3:15 am

        I appreciate your response. Thank you! If you are an affiliate of Genesis, I would be happy to go through your link. Let me know, as you are the one and only that has responded.

        Cheers from across the pond:)

        Log in to Reply
        • Brad Dalton says

          November 9, 2013 at 3:30 am

          Yes, there’s a link in my footer.

          Thanks Sandra.

          Log in to Reply
  7. Eric says

    October 14, 2013 at 5:45 pm

    This is awesome, thanks so much! How can I align right (I tried div align=”right” to no avail) and have the text wrap around the ad block?

    Log in to Reply
    • Brad Dalton says

      October 14, 2013 at 6:07 pm

      Hi Eric

      You could align it in your editor first and then copy the HTML from your text editor into the code.

      Otherwise you will need to add a new class and use it in a new rule in your style sheet.

      Log in to Reply
      • Eric says

        October 14, 2013 at 6:25 pm

        Thanks for the quick response. I kept doing some digging in the code when align: center didn’t work. I changed the word align to float and it worked like a charm. Thanks for sharing this great code!

        Log in to Reply
        • Brad Dalton says

          October 15, 2013 at 3:18 am

          No worries Eric.

          I was thinking about making this into a widget so its more flexible.

          Log in to Reply

Leave a Reply Cancel reply

You must be logged in to post a comment.

Primary Sidebar

Code written by Brad Dalton specialist for Genesis, WooCommerce & WordPress theme customization. Read More…

Advertise · WPEngine · Genesis · Log in

  • Access Problems
  • Account Details
  • Consulting
  • Tags