This topic has 16 replies, 2 voices, and was last updated 8 years by Radu.

  • Author
  • #113936
     dsniche
    Participant

    I want to place Google Adsense units on the Search/Members page, in the search results section. Where should I place my Adsense code?

    #114156
     Radu
    Moderator

    Hi,

    Add this function to your child theme functions.php file (wp-content/themes/sweetdate-child/functions.php)

    COPY CODE
    function sq_add_adsense_to_member_directory() {
    
        echo '
    
        <div style="width:728px;height:90px;background-color:red;"></div>
    
        ';
    
    }
    add_action('bp_before_directory_members_content','sq_add_adsense_to_member_directory');
    

    Replace <div style="width:728px;height:90px;background-color:red;"></div> with 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
    #114174
     dsniche
    Participant

    Thanks Radu, that placed a box at the top of the page before the search results (pic 1). Can I place an ad unit between the rows of search results (pic 2)?

    Attachments:
    You must be logged in to view attached files.
    #114177
     dsniche
    Participant

    Pic 2

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

    You will have to upload the attached file after you unzip it to wp-content/themes/sweetdate-child/members/members-loop.php

    Then you will have to paste your adsense code between

    COPY CODE
        <div style="width:728px;height:90px;background-color:red;display:inline-block;">
        
        //ad-here
        
        </div>

    You can remove width:728px;height:90px;background-color:red; the display:inline-block; is required.

    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.
    #117128
     dsniche
    Participant
    This reply has been set as private.
    #117262
     Radu
    Moderator

    Just give a padding-top:20px; to that div it will resolve the problem

    Cheers

    Radu

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

    Hi Radu, thanks but that didn’t change the alignments. I changed the code to:

    Is this correct?

    #119775
     dsniche
    Participant

    <div style="width:728px;height:90px;background-color:red;display:inline-block;padding-top:20px;">

    #120026
     Radu
    Moderator

    Hi,

    Yes but if this doens’t have effect, you can try with this

    COPY CODE
    
    <div style="width:728px;height:90px;background-color:red;display:inline-block;margin:20px 0 !important; clear:both !important;">
    
    

    Cheers
    R.

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

    Radu, that moved the box a little lower, which I like. But the alignments of the profiles below the box are still the same.

    #120292
     Radu
    Moderator

    Ok,

    Add this css to wp-admin -> theme options -> styling options -> quick css

    COPY CODE
    
    #members-list .four.columns:nth-child(3n+1) {
        clear: none !important;
    }
    

    Cheers
    R.

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

    That worked! Thanks Radu.

    #120621
     dsniche
    Participant

    Can I also add another Adsense unit two rows down, before the last row of the search results?

    #120775
     Radu
    Moderator

    Use the attached file

    If you need other custom modifications look for a developer

    Cheers

    R.

    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.
    #121082
     dsniche
    Participant

    I managed to figure it out. Thanks for your help!

    #121173
     Radu
    Moderator

    Great

    Have a nice week

    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 17 posts - 1 through 17 (of 17 total)

You must be logged in to reply to this topic.

Log in with your credentials

Forgot your details?