Disable Ads On Pages

This topic is: Resolved

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

Tagged: 

This topic contains 11 replies, has 3 voices, and was last updated by  Erick 1 year ago.

  • Author
    Posts
  • #9958

    Erick
    Member
    Post count: 1018

    Hi guys I am aware of

    Can't save setting in homepage

    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 1 year, 6 months ago by  Erick.
    • This topic was modified 1 year, 6 months ago by  Erick.
  • #9991

    Erick
    Member
    Post count: 1018

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

  • #10028

    Max
    Staff
    Post count: 3150

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

    Login | Register | Forgot Password?

  • #10037

    Erick
    Member
    Post count: 1018

    >>>below>>>

    • This reply was modified 1 year, 5 months ago by  Erick.
    • This reply was modified 1 year, 5 months ago by  Erick.
  • #10038

    Erick
    Member
    Post count: 1018

    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
    Post count: 2323

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

    Login | Register | Forgot Password?

  • #10064

    Erick
    Member
    Post count: 1018

    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
    Post count: 2323

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

    Login | Register | Forgot Password?

  • #10144

    Erick
    Member
    Post count: 1018

    Thank you ๐Ÿ™‚ its okay the wrong code you gave me its the one I am using right now ๐Ÿ™‚

  • #11880

    Erick
    Member
    Post count: 1018

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

  • #11905

    Jacob
    Staff
    Post count: 2323

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

    Login | Register | Forgot Password?

  • #12410

    Erick
    Member
    Post count: 1018

    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 1 year ago by  Erick.
    • This reply was modified 1 year ago by  Erick.
    • This reply was modified 1 year ago by  Erick.
    • This reply was modified 1 year ago by  Erick.

You must be logged in to reply to this topic.

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