-
-
Save tommcfarlin/d1edffb9acf3ee3339835a71cd440958 to your computer and use it in GitHub Desktop.
[WordPress] WooCommerce Integrations with WordPress Namespaces
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Acme\Inc\Integration; | |
class Acme_Integration_Bootstrap { | |
public function init() { | |
if ( class_exists( 'WC_Integration' ) ) { | |
include_once 'class-acme-integration.php'; | |
add_filter( | |
'woocommerce_integrations', | |
array( $this, 'add_integration' ) | |
); | |
} | |
} | |
public function add_integration( $integrations ) { | |
// Notice that you must provide the fully-qualified class name. | |
$integrations[] = 'Acme\\Inc\\Integration\\Acme_Integration'; | |
return $integrations; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment