How to add adsense after content in GeneratePress theme

How to add adsense after content in GeneratePress theme – Go to functions.php (Appearance – Theme Editor – functions.php), copy the code of google adsense than paste in functions.php, example :

// Adsense after entry content
function ads_after_entry_content() {
    ?>
<div class="YYYY">

   <ins class="adsbygoogle" 
        style="display: block;" 
        data-ad-client="ca-pub-XXX"
        data-ad-slot="XXX" 
        data-ad-format="auto"
        data-full-width-responsive="true">
  </ins>
  <script>
      (adsbygoogle = window.adsbygoogle || []).push({});
   </script>
  </div>

<?php
}
add_action('generate_after_entry_content', 'ads_after_entry_content');