Disable Ads On Pages

This is a PRIVATE forum for verified users only, to view all replies/answers, you must be logged in!

Status: resolved

Tagged: 

  • This topic has 11 replies, 3 voices, and was last updated 3 y, 7 mo by  Erick.
Viewing 11 reply threads
  • Author
    Posts
    • #9958

      Erick
      Member

      Hi guys I am aware of

      https://wpthms.com/support/topic/cant-save-setting-in-homepage/#post-2794

      but i was wondering how do you integrate the conditional tags to disable top and bottom ads in pages.

      I tried this and although it didn’t break the website it did nothing:

      
      add_filter( 'yt_site_head_ads', 'custom_head_ads_tue04820140638' );
      
      function custom_head_ads_tue04820140638( $ads_content ){
      	if( is_home() || is_front_page() )
              if( is_home() || is_page() )
      
      		$ads_content = '';
      
      	return $ads_content;
      }
      

      I only want to display the bottom ad in the front page like is now (http://ultrabodymind.com/), and desactivate both top and bottom ads in the pages. I think the above code is only for top ads in the front page.

      Thank you

      • This topic was modified 4 y, 1 mo by  Erick.
      • This topic was modified 4 y, 1 mo by  Erick.
    • #9991

      Erick
      Member

      Also I was wondering how to enable the bottom ads in the front page while disabling them elsewhere. Thank you.

    • #10028

      Max
      Staff

      Hey there, You must be logged in to view this reply!

      Login | Register | Forgot Password?

    • #10037

      Erick
      Member

      >>>below>>>

      • This reply was modified 4 y, 1 mo by  Erick.
      • This reply was modified 4 y, 1 mo by  Erick.
    • #10038

      Erick
      Member

      That did it 🙂 thank you maxxi. One last thing, if in the future I want to display ads in the posts footer, how do you change the code? (just exactly like the above code is, just adding the ads in the footer for posts)

      Thank you so much 🙂

    • #10058

      Jacob
      Staff

      Hey there, You must be logged in to view this reply!

      Login | Register | Forgot Password?

    • #10064

      Erick
      Member

      Thank you jacob! although that’s not what I wanted it kinda worked really well. The code you gave me, enable the ads everywhere but the post, (which its pretty useful to know how to do). But the way I wanted was to enable the footer post everywhere but disabling them in pages like this: http://www.ultrabodymind.com/disclaimer/ and still showing the footer ads in the category and author pages.

    • #10127

      Jacob
      Staff

      Hey there, You must be logged in to view this reply!

      Login | Register | Forgot Password?

    • #10144

      Erick
      Member

      Thank you 🙂 its okay the wrong code you gave me its the one I am using right now 🙂

    • #11880

      Erick
      Member

      what are the conditionals if you want to show everywhere but the homepage?

    • #11905

      Jacob
      Staff

      Hey there, You must be logged in to view this reply!

      Login | Register | Forgot Password?

    • #12410

      Erick
      Member

      hide only in pages, show elsewhere

      if( !is_home() && is_front_page() || is_page() )
      

      show only on pages

      if( is_home() || is_singular('post') || is_archive() )
      

      more conditionals

      is_home() 
      || is_front_page() 
      || is_page() 
      || is_archive() 
      || yt_is_woocommerce() 
      || yt_is_bbpress()
      • This reply was modified 3 y, 7 mo by  Erick.
      • This reply was modified 3 y, 7 mo by  Erick.
      • This reply was modified 3 y, 7 mo by  Erick.
      • This reply was modified 3 y, 7 mo by  Erick.
Viewing 11 reply threads
  • You must be logged in to reply to this topic.

This is a PRIVATE forum for verified users only, to view all replies/answers, you must be logged in!

© Copyright 2019 by wpthms.com. All Rights Reserved.