[wordpress] How to Add Adsense Ads to bbPress Forum?

 👁58명의 독자가 공감하셨습니다 

태그: 

1 글 보임 - 1 에서 1 까지 (총 1 중에서)
  • 글쓴이
  • #9079
    mimoon
    키 마스터

    bbPress is a lightweight and powerful forum wordpress. In order to add Adsense Ads in the forum, the best places to add is before and after forum topics.

    Add the following code to the child theme functions.php template.

    function bbpress_header_code() {
    
    echo "Your Ads";
    
    }
    
     
    
    function bbpress_footer_code() {
    
    echo "Your Ads";
    
    }
    
     
    
    add_action( "bbp_template_before_forums_index", "bbpress_header_code" );
    
    add_action( "bbp_template_after_forums_index", "bbpress_footer_code" );
    
    add_action( "bbp_template_before_topics_loop", "bbpress_header_code" );
    
    add_action( "bbp_template_after_topics_loop", "bbpress_footer_code" );
    
    add_action( "bbp_template_before_single_topic", "bbpress_header_code" );
    
    add_action( "bbp_template_after_single_topic", "bbpress_footer_code" );
    
    

    Applying these code will put ads before/after the forum index, single topic page and the topics loop. The advantage of doing so is that it will not be affected if you change/upgrade the bbPress theme/plugin.

1 글 보임 - 1 에서 1 까지 (총 1 중에서)
  • 답변은 로그인 후 가능합니다.
헤르메네이아 미문 (美門)