There are multiple ways to identify if a plugin is active (here’s one) but how can we identify if a specific JetPack component is active, for example Photon?
2 s
We just committed a new function to Jetpack Trunk, and it should be enabled in the next release, Jetpack::is_module_active()
—
http://plugins.trac.wordpress.org/changeset/716884
Then you can just call:
if( class_exists( 'Jetpack' ) && Jetpack::is_module_active( 'contact-form' ) ) {}
Or at least, you will once the next version releases, and the user has their Jetpack updated. 🙂 If you’d like to preserve the backward compatability, you can just do:
if( class_exists( 'Jetpack' ) && in_array( 'contact-form', Jetpack::get_active_modules() ) {}
It’s a slightly tidier way than querying the option directly.