Нема описа

related-posts.php 2.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. /**
  3. * Module Name: Related posts
  4. * Module Description: Keep visitors engaged on your blog by highlighting relevant and new content at the bottom of each published post.
  5. * First Introduced: 2.9
  6. * Sort Order: 29
  7. * Recommendation Order: 9
  8. * Requires Connection: Yes
  9. * Auto Activate: No
  10. * Module Tags: Recommended
  11. * Feature: Engagement
  12. * Additional Search Queries: related, jetpack related posts, related posts for wordpress, related posts, popular posts, popular, related content, related post, contextual, context, contextual related posts, related articles, similar posts, easy related posts, related page, simple related posts, free related posts, related thumbnails, similar, engagement, yet another related posts plugin
  13. */
  14. class Jetpack_RelatedPosts_Module {
  15. /**
  16. * Class variables
  17. */
  18. private static $__instance = null;
  19. /**
  20. * Singleton implementation
  21. *
  22. * @return object
  23. */
  24. public static function instance() {
  25. if ( ! is_a( self::$__instance, 'Jetpack_RelatedPosts_Module' ) )
  26. self::$__instance = new Jetpack_RelatedPosts_Module();
  27. return self::$__instance;
  28. }
  29. /**
  30. * Register actions and filters
  31. *
  32. * @uses add_action, add_filter
  33. */
  34. private function __construct() {
  35. add_action( 'jetpack_module_loaded_related-posts', array( $this, 'action_on_load' ) );
  36. }
  37. /**
  38. * This action triggers if the module is in an active state, load related posts and options.
  39. *
  40. * @uses Jetpack_RelatedPosts::init, is_admin, Jetpack::enable_module_configurable, Jetpack_Sync::sync_posts
  41. * @return null
  42. */
  43. public function action_on_load() {
  44. require_once 'related-posts/jetpack-related-posts.php';
  45. Jetpack_RelatedPosts::init();
  46. if ( is_admin() ) {
  47. Jetpack::enable_module_configurable( __FILE__ );
  48. }
  49. // Load Customizer controls.
  50. if ( class_exists( WP_Customize_Manager::class ) && class_exists( WP_Customize_Control::class ) ) {
  51. require_once 'related-posts/class.related-posts-customize.php';
  52. }
  53. }
  54. }
  55. // Do it.
  56. Jetpack_RelatedPosts_Module::instance();