carousel
1 year ago
comment-likes
1 year ago
comments
1 year ago
custom-post-types
1 year ago
external-media
1 year ago
google-fonts
11 months ago
gravatar
6 years ago
infinite-scroll
11 months ago
likes
1 year ago
markdown
1 year ago
memberships
11 months ago
photon-cdn
11 months ago
plugin-search
1 year ago
post-by-email
1 year ago
related-posts
11 months ago
scan
1 year ago
seo-tools
1 year ago
sharedaddy
11 months ago
shortcodes
11 months ago
simple-payments
1 year ago
site-icon
11 months ago
sitemaps
11 months ago
stats
1 year ago
subscriptions
11 months ago
theme-tools
11 months ago
tiled-gallery
1 year ago
verification-tools
1 year ago
videopress
11 months ago
widget-visibility
11 months ago
widgets
11 months ago
woocommerce-analytics
11 months ago
wordads
1 year ago
wpcom-tos
1 year ago
account-protection.php
1 year ago
blaze.php
1 year ago
blocks.php
1 year ago
carousel.php
1 year ago
comment-likes.php
1 year ago
comments.php
1 year ago
contact-form.php
1 year ago
copy-post.php
1 year ago
custom-content-types.php
1 year ago
google-fonts.php
1 year ago
gravatar-hovercards.php
1 year ago
infinite-scroll.php
1 year ago
json-api.php
1 year ago
latex.php
1 year ago
likes.php
1 year ago
markdown.php
1 year ago
module-extras.php
1 year ago
module-headings.php
1 year ago
module-info.php
1 year ago
monitor.php
1 year ago
notes.php
1 year ago
photon-cdn.php
1 year ago
photon.php
1 year ago
plugin-search.php
1 year ago
post-by-email.php
1 year ago
post-list.php
1 year ago
protect.php
1 year ago
publicize.php
1 year ago
related-posts.php
1 year ago
search.php
1 year ago
seo-tools.php
1 year ago
sharedaddy.php
1 year ago
shortcodes.php
1 year ago
shortlinks.php
11 months ago
simple-payments.php
1 year ago
sitemaps.php
1 year ago
sso.php
1 year ago
stats.php
11 months ago
subscriptions.php
11 months ago
theme-tools.php
1 year ago
tiled-gallery.php
1 year ago
vaultpress.php
1 year ago
verification-tools.php
1 year ago
videopress.php
1 year ago
waf.php
1 year ago
widget-visibility.php
1 year ago
widgets.php
1 year ago
woocommerce-analytics.php
1 year ago
wordads.php
1 year ago
wpgroho.js
1 year ago
related-posts.php
79 lines
| 1 | <?php //phpcs:ignore WordPress.Files.FileName.InvalidClassFileName |
| 2 | /** |
| 3 | * Module Name: Related posts |
| 4 | * Module Description: Automatically display related articles to keep visitors reading longer. |
| 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, creator |
| 14 | * |
| 15 | * @package automattic/jetpack |
| 16 | */ |
| 17 | |
| 18 | if ( ! defined( 'ABSPATH' ) ) { |
| 19 | exit( 0 ); |
| 20 | } |
| 21 | |
| 22 | /** |
| 23 | * Class Jetpack_RelatedPosts_Module |
| 24 | * |
| 25 | * @phan-constructor-used-for-side-effects |
| 26 | */ |
| 27 | class Jetpack_RelatedPosts_Module { |
| 28 | /** |
| 29 | * Class variables |
| 30 | * |
| 31 | * @var Jetpack_RelatedPosts_Module |
| 32 | */ |
| 33 | private static $instance = null; |
| 34 | |
| 35 | /** |
| 36 | * Singleton implementation |
| 37 | * |
| 38 | * @return object |
| 39 | */ |
| 40 | public static function instance() { |
| 41 | if ( ! is_a( self::$instance, 'Jetpack_RelatedPosts_Module' ) ) { |
| 42 | self::$instance = new Jetpack_RelatedPosts_Module(); |
| 43 | } |
| 44 | |
| 45 | return self::$instance; |
| 46 | } |
| 47 | |
| 48 | /** |
| 49 | * Register actions and filters |
| 50 | * |
| 51 | * @uses add_action, add_filter |
| 52 | */ |
| 53 | private function __construct() { |
| 54 | add_action( 'jetpack_module_loaded_related-posts', array( $this, 'action_on_load' ) ); |
| 55 | } |
| 56 | |
| 57 | /** |
| 58 | * This action triggers if the module is in an active state, load related posts and options. |
| 59 | * |
| 60 | * @uses Jetpack_RelatedPosts::init, is_admin, Jetpack::enable_module_configurable, Jetpack_Sync::sync_posts |
| 61 | */ |
| 62 | public function action_on_load() { |
| 63 | require_once __DIR__ . '/related-posts/jetpack-related-posts.php'; |
| 64 | Jetpack_RelatedPosts::init(); |
| 65 | |
| 66 | if ( is_admin() ) { |
| 67 | Jetpack::enable_module_configurable( __FILE__ ); |
| 68 | } |
| 69 | |
| 70 | // Load Customizer controls. |
| 71 | if ( class_exists( WP_Customize_Manager::class ) && class_exists( WP_Customize_Control::class ) ) { |
| 72 | require_once __DIR__ . '/related-posts/class.related-posts-customize.php'; |
| 73 | } |
| 74 | } |
| 75 | } |
| 76 | |
| 77 | // Do it. |
| 78 | Jetpack_RelatedPosts_Module::instance(); |
| 79 |