This topic has 31 replies, 4 voices, and was last updated 8 years by Radu.

  • Author
  • #103470
     ericlianda
    Participant

    How can I add google adsense so my website can profit from advertisements while running sweetdate theme?

    #103612
     Radu
    Moderator

    Hi,

    For sidebars you can paste your adsense code into a text widget in your desired sitebar,

    Where do you want to place another adsense ads ?

    Cheers

    Radu

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #103630
     ericlianda
    Participant

    Hi Radu,
    Thanks, for now I want to place the adsense code in the sidebar. Is there a documentation of where exactly the code will be put? or a link you can guide me to?

    #103881
     thannah
    Participant

    What about adding it to buddypress activity stream or a banner ad on the top of the activity page? I’ve been working with it and the code works fine I just can’t get it to show up on this particular page. What could I be doing wrong?

    #103983
     Radu
    Moderator

    Hi ericlianda,

    Please go to wp-admin -> appearance -> widgets -> add to main sidebar widget named Text and paste your adsense code.

    Cheers

    Radu

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #103984
     Radu
    Moderator

    Hi thannah,

    Please add this php snippet to your child theme /functions.php ( wp-content/themes/sweetdate-child/functions.php )

    COPY CODE
    
    function banner_before_activity() {
    
        echo '<div class="row">';
        echo '<img src="http://northdelawhere.happeningmag.com/wp-content/uploads/728x90-example-banner-600x90.jpg">';
        echo '</div>';
    }
    add_action ('bp_before_directory_activity_page', 'banner_before_activity');
    

    Replace

    COPY CODE
    
    <img src="http://northdelawhere.happeningmag.com/wp-content/uploads/728x90-example-banner-600x90.jpg">
    

    with your desired code.

    Cheers

    Radu

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #104047
     thannah
    Participant

    Thank you!

    #104155
     Radu
    Moderator

    You’re welcome

    Have a nice week

    Cheers

    Radu

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #109836
     Loyal_Customer
    Participant

    Hi,
    Which file do I need to edit to place the AdSense code between member rows on the Member Search page? (The circled area in the attached screenshot).

    Attachments:
    You must be logged in to view attached files.
    #110354
     Radu
    Moderator

    Hi,

    Add the attached file to wp-content/themes/kleo-child/buddypress/members/members-loop.php

    Then open the file look around line 40 and replace the follwing

    COPY CODE
    
    
    <img src="http://s3.amazonaws.com/fotor.onlineresource/0b2c5f2b80b24f1a9cb6951e6c48ca50/0b2c5f2b80b24f1a9cb6951e6c48ca50_o.jpg">
    
    

    place inside ” you adsense code

    COPY CODE
    
    echo '<img src="http://s3.amazonaws.com/fotor.onlineresource/0b2c5f2b80b24f1a9cb6951e6c48ca50/0b2c5f2b80b24f1a9cb6951e6c48ca50_o.jpg">';
    

    Cheers

    Radu

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    Attachments:
    You must be logged in to view attached files.
    #111018
     Loyal_Customer
    Participant

    Hi Radu,

    Thank you for your response. I noticed you mentioned “kleo-child,” but the theme I’m working with is Sweetdate. Please what are the instructions for Sweetdate?

    #111270
     Radu
    Moderator

    Hi,

    Yes you right, my bad,

    Use the attached file and upload it to wp-content/themes/sweetdate-child/members

    NOTE : The child theme needs to be activated.

    Cheers

    Radu

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    Attachments:
    You must be logged in to view attached files.
    #115181
     Loyal_Customer
    Participant

    Hi Radu,

    Thanks. I tried the file code, but there doesn’t seem to be enough room for an ad to fit between the small space. How can I increase the space size between the two rows to make it wider? (Please see attached screenshot).

    Attachments:
    You must be logged in to view attached files.
    #115308
     Radu
    Moderator

    Put all your add code in a div like this

    COPY CODE
    <div style="display: inline-block !important;">
    Your add code
    </div>

    Cheers

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #115310
     Loyal_Customer
    Participant

    You wrote “div like this” but there’s no example. I’m not sure if your entire message came through.

    #115329
     Radu
    Moderator

    I’ve forgot to place code tags and the div was rendered, sorry for that check now

    Cheers

    Radu

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #115394
     Loyal_Customer
    Participant

    Okay. Do I put the div code before or after the the img src part?

    For example:

    echo ‘<div style=”display: inline-block !important;” <img src=”(ADSENCE CODE HERE)”/’; CLOSE DIV

    OR

    echo ‘<img src=” <div style=”display: inline-block !important;” (ADSENCE CODE HERE) CLOSE DIV “/’

    #115583
     Radu
    Moderator

    IF you will using an adsense code you will no need the img so the code will be like this

    COPY CODE
    echo = '
    <div style="display: inline-block !important;">
    
    Your add code
    
    </div>
    
    ';
    

    Cheers

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #116413
     Loyal_Customer
    Participant

    Hi Radu,

    I appreciate your help. I copy and pasted the code into the Members-loop file exactly as you stated, and replaced the words “your ad code” with my actual ad code, but it makes the everything on the Members directory below the words “Members” disappear.

    What might be causing this to happen?

    #116584
     Radu
    Moderator

    This type of issue can be caused by the code that ar you paste more exactly a JS error

    If you have a js code paste with with <script> tags </script>

    Cheers

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #116636
     Loyal_Customer
    Participant

    Hi Radu,

    I’m not able to read your last reply, since it’s marked as “private.”

    #116839
     Radu
    Moderator

    check now

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #117989
     Loyal_Customer
    Participant

    Thanks. The AdSense code is already enclosed in “script” and the member page content is now okay. However, the ad is showing up partially behind the member box rows (Please see attached screenshot).

    I’m trying to make the space between the rows bigger using the code you gave me earlier (“div style=”display: inline-block !important;”). However, when I put the code around the AdSense code, the ad on the page completely disappears.

    Is there another way to increase the space between profile box rows?

    Attachments:
    You must be logged in to view attached files.
    #118029
     Radu
    Moderator

    Try to add beside the display:inline-block height:90, from example

    COPY CODE
    
    
    <div style="display: inline-block !important; height:90px !important; margin:10px 0 !important ;">
    
    Your add code
    
    </div>
    
    
    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #118236
     Loyal_Customer
    Participant

    The “div style” code is still causing the ad to not show up on the page.

    Also, I realized that putting an AdSense code anywhere on the Members-loop file makes the page number buttons at the bottom of the page completely non-functional.

    For example, when you are on page 1 of the members directory, everything is fine, but as soon as you click the “2” button, it takes you to a blank page that says “Members” at the top, but no members appear (Please see attached screenshots).

    In order to avoid this problem, is there any way to embed the code somewhere on the Members Directory page without affecting the functionality of the number buttons located at the bottom?

    Attachments:
    You must be logged in to view attached files.
    #118381
     Radu
    Moderator

    Hi,

    On my install with the code that i have provided to you i can change the page with no problem,

    Are you sure the issue is caused by that code ? Maybe other is problem a plugin or other code from child ?

    R.

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #118628
     Loyal_Customer
    Participant

    Hi,

    I realized that the issue is most likely being caused by the AdSense code itself, and not the div code.
    When I removed the AdSense code and replaced it with a regular “img src=” picture banner, the page numbers started to work again.

    Are you testing it out on your install with an actual AdSense code?

    If not, could you please test it with an AdSense code and let me know if it still lets you change the page without any issues?

    I would like to try and see if there’s any way to fix this if the AdSense code format is what’s really causing the problem.

    Thank you.

    #118826
     Radu
    Moderator

    Hi,

    I’ve using an dummy adsense account for testing and there is only a empty space (white space) but if i change page the ad-place is empty (white ) and in source code the iframes from the ad are loaded but it shows white instead of any ad and the rest of layout shows ok.

    Cheers

    R.

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #118828
     Loyal_Customer
    Participant

    The members on the next page don’t disappear when you change the page from 1 to 2 when you have the AdSense code on the page?

    #118834
     Radu
    Moderator

    My code doesn’t show blank because i’m localhost, anyways i’ve found this

    https://productforums.google.com/forum/#!topic/adsense/kqVvPLEAeRs

    It seems that adsense doesn’t work with ajax, but you can try to disable ajax pagination, please follow this : https://buddypress.org/support/topic/custom-members-directory-breaks-pagination/#post-169329 it seems that you will need to put no-ajax on pagination div

    Cheers

    R.

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #122165
     Loyal_Customer
    Participant

    Hi Radu,

    Thank you for the links.
    Sorry for the late response. I didn’t see your reply until today.

    You’re right— Ajax was the problem, and the issue has been resolved. Thanks for all your help!

    #122272
     Radu
    Moderator

    Hi,

    No problem

    Cheers
    R.

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
Viewing 32 posts - 1 through 32 (of 32 total)

You must be logged in to reply to this topic.

Log in with your credentials

Forgot your details?