Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jaworowicz/3648306ea45913fd60f4ed01458cb22f to your computer and use it in GitHub Desktop.
Save jaworowicz/3648306ea45913fd60f4ed01458cb22f to your computer and use it in GitHub Desktop.
// Czy wtyczka jest aktywna - Przykład WooCommerce
if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {
echo 'WooCommerce aktywny.';
} else {
echo 'WooCommerce nie aktywny.';
}
// Czy klasa istnieje - If Class Exist
if ( class_exists( 'WooCommerce' ) ) {
// Kod wymagający WooCommerce
} else {
// Inny kod, gdy klasa nie istnieje - najczęściej puste
}
// Czy funkcja istnieje - If function exist
if (function_exists('register_nav_menus')) {
register_nav_menus (array('primary' => 'MENU GORNE'));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment