Skip to main content
added __destruct option
Source Link
Pat J
  • 12.3k
  • 2
  • 28
  • 36

You could use is_child_theme() in the parent theme's functions.php file:

if ( ! is_child_theme() ) {
    require( 'path/to/ads/file.php' );
}

Update

If you don't want to edit the parent theme -- for instance, so that any updates to the parent theme won't overwrite what you've done -- you could do something like this in the child theme's functions.php file:

global $ads_class; // whatever your ads class is named
if ( 
    is_child_theme() && 
    ( 
      class_exists( 'Ads_Class' ) && 
      'Ads_Class' == get_class( $ads_class) 
    )
   ) {
    $ads_class->__destruct();
}

You could use is_child_theme() in the parent theme's functions.php file:

if ( ! is_child_theme() ) {
    require( 'path/to/ads/file.php' );
}

You could use is_child_theme() in the parent theme's functions.php file:

if ( ! is_child_theme() ) {
    require( 'path/to/ads/file.php' );
}

Update

If you don't want to edit the parent theme -- for instance, so that any updates to the parent theme won't overwrite what you've done -- you could do something like this in the child theme's functions.php file:

global $ads_class; // whatever your ads class is named
if ( 
    is_child_theme() && 
    ( 
      class_exists( 'Ads_Class' ) && 
      'Ads_Class' == get_class( $ads_class) 
    )
   ) {
    $ads_class->__destruct();
}
Source Link
Pat J
  • 12.3k
  • 2
  • 28
  • 36

You could use is_child_theme() in the parent theme's functions.php file:

if ( ! is_child_theme() ) {
    require( 'path/to/ads/file.php' );
}