Viewing 18 posts - 1 through 18 (of 18 total)
  • Author
    Posts
  • #95526
    spespam
    Participant

    Hello,

    I would like to insert an adsense banner just under the menu but I can’t manage to do it.

    Can somebody help me to do it ?

    Thank you !

    #95545
    Pratik
    Participant

    Can you post in your site url?

    #95551
    spespam
    Participant

    Hello Pratik

    Why do you need my url ? Isn’t catchbox the same for everyone who uses it ?

    #95571
    Pratik
    Participant

    @spespam:
    Although the theme is same, different sites have different conditions due to plugins used. It will be better if you could provide me with the site so I cna check it the adsense code would work on the place where you want.

    #118066
    wordaz
    Participant

    Hello,

    I also have this challenge. Im trying to add adsense link units below the menu and below the fold. My website is https://mtn4u.com/
    Kindly assist

    #118089
    Pratik
    Participant

    Hi @wordaz,

    You have two menus and then slider. Where exactly do you want the ad?

    First thing first, for this, you will need to create a child theme. First, create a child theme using tutorial: http://catchthemes.com/blog/create-child-theme-wordpress/

    Then, let me know where you want the add and I will provide you code to place the ad.

    Regards,
    Pratik

    #118128
    wordaz
    Participant

    Hello, Thanks for the info.

    I have set up a child theme on the website. I want to place the ad inbetween the 2nd menu and slider.

    Also how do I add ads to my home page,
    1) just below the featured content section
    2) Just above featured content section/below slider section
    2) inbetween each post brief as seen on home page (maybe doing so every couple of posts). Please is this possible?

    I want to try out these various options to see which one will best suit the site

    Thank you and regards

    #118170
    Pratik
    Participant

    Hi @wordaz,

    First make function and add it to functions.php file:

    
    function clean_journal_child_ad(){
    ?>
    <!-- Add google ad code here -->
    <?php
    }
    

    Then after this function, add following code in functions.php as given condition:
    Inbetween the 2nd menu and slider:

    
    add_action( 'clean_journal_before_content', 'clean_journal_child_ad', 5 );
    

    1) just below the featured content section

    
    add_action( 'clean_journal_before_content', 'clean_journal_child_ad', 45 );
    

    2) Just above featured content section/below slider section

    
    add_action( 'clean_journal_before_content', 'clean_journal_child_ad', 30 );
    

    2) inbetween each post brief as seen on home page (maybe doing so every couple of posts). Please is this possible?
    * For this, you will need to hire a customizer. This now has gone beyond our theme support scope.

    regards,
    Pratik

    #118187
    wordaz
    Participant

    Hello Pratik.
    Im not sure Im getting this right as its not working. I went to Themes – Child Themes – Files – “Click to edit Files using Child Theme Editor”

    The last line of code in the “Clean Journal Child 02: Theme Functions (functions.php)” is;
    endif;
    add_action( ‘wp_enqueue_scripts’, ‘child_theme_configurator_css’ );

    I then added the following immediately after it;
    function clean_journal_child_ad(){
    ?>
    <!– Add google ad code here –>
    <?php
    }
    add_action( ‘clean_journal_before_content’, ‘clean_journal_child_ad’, 45 );

    and then saved. Nothing however is reflecting on my webpage.

    Pls assist. What did I do wrong.? How do I rectify it?

    #118188
    Pratik
    Participant

    Hi @wordaz,

    You need to replace <!– Add google ad code here –> with your google adsense code.

    #118255
    wordaz
    Participant

    Hi Pratik,

    Ive tried all that but nothing seems to be working at the moment. (I even tried adding “if” and “endif” statements to no avail). It fails to render in the preview.

    Currently my child themes “functions.php” code looks like this;

    <?php
    // Exit if accessed directly
    if ( !defined( ‘ABSPATH’ ) ) exit;

    // BEGIN ENQUEUE PARENT ACTION
    // AUTO GENERATED – Do not modify or remove comment markers above or below:

    if ( !function_exists( ‘chld_thm_cfg_parent_css’ ) ):
    function chld_thm_cfg_parent_css() {
    wp_enqueue_style( ‘chld_thm_cfg_parent’, trailingslashit( get_template_directory_uri() ) . ‘style.css’, array( ) );
    }
    endif;
    add_action( ‘wp_enqueue_scripts’, ‘chld_thm_cfg_parent_css’, 10 );
    function clean_journal_child_ad(){
    ?>
    <!– <script async src=”//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js”></script>
    <!– MTN4U Banner Ad –>
    <ins class=”adsbygoogle”
    style=”display:inline-block;width:728px;height:90px”
    data-ad-client=”ca-pub-****************”
    data-ad-slot=”**********”></ins>
    <script>
    (adsbygoogle = window.adsbygoogle || []).push({});
    </script> –>
    <?php
    }
    add_action( ‘clean_journal_before_content’, ‘clean_journal_child_ad’, 30 );

    // END ENQUEUE PARENT ACTION

    Kindly advise on what Im doing wrong.

    Thanks

    #118257
    Pratik
    Participant

    Hi @wordaz,

    Are you sure there is line <!– <script async src=”//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js”></script>, the initial <!-- comments out the code. Please check the code again properly.

    Your function should look like following:

    
    function clean_journal_child_ad(){
    ?>
    <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
    
    <ins class="adsbygoogle"
    style="display:inline-block;width:728px;height:90px"
    data-ad-client="ca-pub-1234567890123456"
    data-ad-slot="1234567890"></ins>
    <script>
    (adsbygoogle = window.adsbygoogle || []).push({});
    </script>
    <?php
    }
    

    You need to remove the comments <!-- and --> at start and end, don’t just remove the text.

    #118268
    wordaz
    Participant

    Thanks a lot Pratik.

    Working perfectly now.

    Cheers

    #118282
    Pratik
    Participant

    Hi @wordaz,

    I quickly checked your site and saw it working. There is some cdsign issue with google ad. You can fix it using following code in Appearance=> Customize=> Additional CSS box:

    
    ins.adsbygoogle {
        background-color: #ffffff;
        text-align: center;
    }
    

    This should blend the google code.

    Finally, if you liked my supportm, it would be great if you could leave a review at https://wordpress.org/themes/clean-journal/. A positive review would be great 🙂

    Regards,
    Pratik

    #118288
    wordaz
    Participant

    Oh, thanks a lot – Just finished that review.

    Meanwhile, I used the same code for my other site but its not having the same effect (not blending in the Google code)

    I also noted that after adding my google adsense code for the site following your instructions for my 1st site (mtn4u.com), the top article (title and “more”) in the scroll down list does not highlight and is no longer clickable. It is also difficult to click the articles in the “Recent Posts”.

    Can you help me look at it pls. The site is
    https://intechreviews.com/

    #118290
    Pratik
    Participant

    Hi @wordaz,

    I checked your site and you have made mistake in copying and pasting the code. The code you have pasted is

    
    ns.adsbygoogle {
        background-color: #ffffff;
        text-align: center;
    }
    

    ,

    please make sure you have i.

    full code:

    
    ins.adsbygoogle {
        background-color: #ffffff;
        text-align: center;
    }
    
    #118291
    wordaz
    Participant

    Thank you.

    Working perfectly now
    Cheers

    #118292
    Pratik
    Participant

    Hi @wordaz,

    Glad it worked 🙂

    Regards,
    Pratik

Viewing 18 posts - 1 through 18 (of 18 total)
  • The topic ‘insert adsense under the menu’ is closed to new replies.