• 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

Widget between the first and second paragraph

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 › Widget between the first and second paragraph

This topic is: not resolved
  • This topic has 11 replies, 4 voices, and was last updated 7 years, 5 months ago by Dan Merry.
Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • October 10, 2015 at 6:12 pm #167810
    Dan Merry
    Participant

    Hello everyone here, I'm new at this forum and need help to accomplish something I want.
    I need to add a widget area for to place Adsense ads in between the first and second paragraph on every post in my blog.
    I'm using Agency Pro theme.
    Can some one here help me please?
    TANKS 🙂

    October 10, 2015 at 8:47 pm #167816
    Victor Font
    Moderator

    You need a plugin like this one: https://wordpress.org/plugins/amr-shortcode-any-widget/


    Regards,

    Victor
    https://victorfont.com/
    Call us toll free: 844-VIC-FONT (842-3668)
    Have you requested your free website audit yet?

    October 10, 2015 at 10:04 pm #167819
    Dan Merry
    Participant

    Hi Victor, thank for your replay, I appreciate it.
    Any way, is there a way to do that without a plugin?? I prefer to do it without plugin.
    Thanks in advance my friend.

    October 11, 2015 at 3:32 pm #167865
    Victor Font
    Moderator

    You need to use the plugin. A widget area is technically a sidebar. I don't know of any other way to insert a widget between paragraphs without using a shortcode.


    Regards,

    Victor
    https://victorfont.com/
    Call us toll free: 844-VIC-FONT (842-3668)
    Have you requested your free website audit yet?

    October 11, 2015 at 4:23 pm #167873
    Brad Dalton
    Participant

    I wrote 2 tutorials about how to do this however they're for members only who don't mind paying for custom code.

    You might try searching Google as i think there are several freely accessible code snippets out there. May need to modify them a bit to work with Genesis.


    Tutorials for StudioPress Themes.

    October 11, 2015 at 7:13 pm #167877
    Dan Merry
    Participant

    Hello guys, thanks a lot for you take care of my question.

    Brad I got the following piece of code from your post in gist.github, can you please tell me what would I have to edit in it?

    /*** 
    @author Brad Dalton - WP Sites
    @link http://wpsites.net/web-design/ads-specific-paragraph-single-posts/
    ***/
    add_filter( 'the_content', 'wpsites_adsense_middle_content' );
    function wpsites_adsense_middle_content( $content ) {
            if( !is_single() )
                return $content;
    
                $paragraphAfter = 3; //Enter paragraph number
                $content = explode ( "</p>", $content );
                $new_content = '';
                    for ( $i = 0; $i < count ( $content ); $i ++ ) {
                        if ( $i == $paragraphAfter ) {
                        $new_content .= '<div style="width: 600px; height: 100px; padding: 5px 5px 5px 0; margin-right: 0;">';
                        $new_content .= 'Paste Adsense Code Here';
                        $new_content .= '</div>';
                        }
                $new_content .= $content[$i] . "</p>";
                }
                return $new_content;
        }
    

    THANK YOU very much.

    October 11, 2015 at 7:44 pm #167883
    Brad Dalton
    Participant

    Hi Dan

    Read this please http://wpsites.net/disclosure-privacy/

    And this http://www.studiopress.community/policies-and-guidelines/


    Tutorials for StudioPress Themes.

    October 11, 2015 at 7:47 pm #167884
    Dan Merry
    Participant

    Hi Brad I realize that I have to add the Adsense code and set the number of paragrph, but what about the following line?

     wpsites_adsense_middle_content 

    Do I have to change something in that line?

    Thanks again.

    October 11, 2015 at 8:00 pm #167886
    Dan Merry
    Participant

    OH!!! I'm so sorry Brad, I didn't know that 🙁

    October 11, 2015 at 8:04 pm #167887
    Brad Dalton
    Participant

    No worries. The code should work if you add it in your functions file.

    If you need modification to it, you will need membership.


    Tutorials for StudioPress Themes.

    October 11, 2015 at 9:57 pm #167888
    nongtinh3
    Member

    I wrote 2 tutorials about how to do this however they’re for members only who don’t mind paying for custom code.


    sua may giat

    October 12, 2015 at 6:33 am #167906
    Dan Merry
    Participant

    Hi Brad thanks, and thanks for you recommend wpsite to me, I'm considering be a member, seems that for any need with Genesis there is a snippet or a code.

  • 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