PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 6.2.3
Jetpack – WP Security, Backup, Speed, & Growth v6.2.3
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 6.2.3, at modules/related-posts.php

79 lines 2.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Module Name: Related posts
4 * Module Description: Increase page views by showing related content to your visitors.
5 * Jumpstart Description: Keep visitors engaged on your blog by highlighting relevant and new content at the bottom of each published post.
6 * First Introduced: 2.9
7 * Sort Order: 29
8 * Recommendation Order: 9
9 * Requires Connection: Yes
10 * Auto Activate: No
11 * Module Tags: Recommended
12 * Feature: Engagement, Jumpstart
13 * Additional Search Queries: related, related posts
14 */
15 class Jetpack_RelatedPosts_Module {
16 /**
17 * Class variables
18 */
19 private static $__instance = null;
20
21 /**
22 * Singleton implementation
23 *
24 * @return object
25 */
26 public static function instance() {
27 if ( ! is_a( self::$__instance, 'Jetpack_RelatedPosts_Module' ) )
28 self::$__instance = new Jetpack_RelatedPosts_Module();
29
30 return self::$__instance;
31 }
32
33 /**
34 * Register actions and filters
35 *
36 * @uses add_action, add_filter
37 */
38 private function __construct() {
39 add_action( 'jetpack_module_loaded_related-posts', array( $this, 'action_on_load' ) );
40 }
41
42 /**
43 * This action triggers if the module is in an active state, load related posts and options.
44 *
45 * @uses Jetpack_RelatedPosts::init, is_admin, Jetpack::enable_module_configurable, Jetpack::module_configuration_load, Jetpack_Sync::sync_posts
46 * @return null
47 */
48 public function action_on_load() {
49 require_once 'related-posts/jetpack-related-posts.php';
50 Jetpack_RelatedPosts::init();
51
52 if ( is_admin() ) {
53 // Enable "Configure" button on module card
54 Jetpack::enable_module_configurable( __FILE__ );
55 Jetpack::module_configuration_load( __FILE__, array( $this, 'module_configuration_load' ) );
56 }
57
58 // Load Customizer controls.
59 if ( class_exists( 'WP_Customize_Manager' ) ) {
60 require_once 'related-posts/class.related-posts-customize.php';
61 }
62 }
63
64 /**
65 * Redirect configure button to Settings > Reading
66 *
67 * @uses wp_safe_redirect, admin_url
68 * @return null
69 */
70 public function module_configuration_load() {
71 wp_safe_redirect( admin_url( 'options-reading.php#jetpack_relatedposts' ) );
72 exit;
73 }
74
75 }
76
77 // Do it.
78 Jetpack_RelatedPosts_Module::instance();
79