PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 12.6
Jetpack – WP Security, Backup, Speed, & Growth v12.6
16.2-beta 12.0.3 12.1.3 12.2.3 12.3.2 12.4.2 12.5.2 12.6.4 12.7.3 12.8.3 12.9.5 13.0.2 13.1.5 13.2.4 13.3.3 13.4.5 13.5.2 13.6.2 13.7.2 13.8.3 13.9.2 14.0.1 14.1.1 14.2.2 14.3.1 All 501 releases
jetpack / modules / related-posts.php

related-posts.php in Jetpack – WP Security, Backup, Speed, & Growth 12.6, at modules/related-posts.php

67 lines 2.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php //phpcs:ignore WordPress.Files.FileName.InvalidClassFileName
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 * // phpcs:ignore WordPress.WP.CapitalPDangit.MisspelledInComment
13 * 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
14 */
15 class Jetpack_RelatedPosts_Module {
16 /**
17 * Class variables
18 *
19 * @var Jetpack_RelatedPosts_Module
20 */
21 private static $instance = null;
22
23 /**
24 * Singleton implementation
25 *
26 * @return object
27 */
28 public static function instance() {
29 if ( ! is_a( self::$instance, 'Jetpack_RelatedPosts_Module' ) ) {
30 self::$instance = new Jetpack_RelatedPosts_Module();
31 }
32
33 return self::$instance;
34 }
35
36 /**
37 * Register actions and filters
38 *
39 * @uses add_action, add_filter
40 */
41 private function __construct() {
42 add_action( 'jetpack_module_loaded_related-posts', array( $this, 'action_on_load' ) );
43 }
44
45 /**
46 * This action triggers if the module is in an active state, load related posts and options.
47 *
48 * @uses Jetpack_RelatedPosts::init, is_admin, Jetpack::enable_module_configurable, Jetpack_Sync::sync_posts
49 */
50 public function action_on_load() {
51 require_once __DIR__ . '/related-posts/jetpack-related-posts.php';
52 Jetpack_RelatedPosts::init();
53
54 if ( is_admin() ) {
55 Jetpack::enable_module_configurable( __FILE__ );
56 }
57
58 // Load Customizer controls.
59 if ( class_exists( WP_Customize_Manager::class ) && class_exists( WP_Customize_Control::class ) ) {
60 require_once __DIR__ . '/related-posts/class.related-posts-customize.php';
61 }
62 }
63 }
64
65 // Do it.
66 Jetpack_RelatedPosts_Module::instance();
67