module-extras.php 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. /*
  3. * Load module code that is needed even when a module isn't active.
  4. * For example, if a module shouldn't be activatable unless certain conditions are met, the code belongs in this file.
  5. */
  6. // Include extra tools that aren't modules, in a filterable way
  7. $tools = array(
  8. 'theme-tools/social-links.php',
  9. 'theme-tools/random-redirect.php',
  10. 'theme-tools/featured-content.php',
  11. 'theme-tools/infinite-scroll.php',
  12. 'theme-tools/responsive-videos.php',
  13. 'theme-tools/site-logo.php',
  14. 'theme-tools/site-breadcrumbs.php',
  15. 'theme-tools/social-menu.php',
  16. 'theme-tools/content-options.php',
  17. 'custom-post-types/comics.php',
  18. 'custom-post-types/testimonial.php',
  19. 'custom-post-types/nova.php',
  20. 'theme-tools.php',
  21. 'seo-tools/jetpack-seo-utils.php',
  22. 'seo-tools/jetpack-seo-titles.php',
  23. 'seo-tools/jetpack-seo-posts.php',
  24. 'simple-payments/simple-payments.php',
  25. 'verification-tools/verification-tools-utils.php',
  26. 'woocommerce-analytics/wp-woocommerce-analytics.php',
  27. 'geo-location.php'
  28. );
  29. // Not every tool needs to be included if Jetpack is inactive and not in development mode
  30. if ( ! Jetpack::is_active() && ! Jetpack::is_development_mode() ) {
  31. $tools = array(
  32. 'seo-tools/jetpack-seo-utils.php',
  33. 'seo-tools/jetpack-seo-titles.php',
  34. 'seo-tools/jetpack-seo-posts.php',
  35. );
  36. }
  37. /**
  38. * Filter extra tools (not modules) to include.
  39. *
  40. * @since 2.4.0
  41. * @since 5.4.0 can be used in multisite when Jetpack is not connected to WordPress.com and not in development mode.
  42. *
  43. * @param array $tools Array of extra tools to include.
  44. */
  45. $jetpack_tools_to_include = apply_filters( 'jetpack_tools_to_include', $tools );
  46. if ( ! empty( $jetpack_tools_to_include ) ) {
  47. foreach ( $jetpack_tools_to_include as $tool ) {
  48. if ( file_exists( JETPACK__PLUGIN_DIR . '/modules/' . $tool ) ) {
  49. require_once( JETPACK__PLUGIN_DIR . '/modules/' . $tool );
  50. }
  51. }
  52. }
  53. /**
  54. * Add the "(Jetpack)" suffix to the widget names
  55. */
  56. function jetpack_widgets_add_suffix( $widget_name ) {
  57. return sprintf( __( '%s (Jetpack)', 'jetpack' ), $widget_name );
  58. }
  59. add_filter( 'jetpack_widget_name', 'jetpack_widgets_add_suffix' );