kollapsminoriteten/wp-content/plugins/jetpack/modules/related-posts.php

67 lines
2.1 KiB
PHP
Raw Normal View History

2022-06-16 14:01:47 +02:00
<?php //phpcs:ignore WordPress.Files.FileName.InvalidClassFileName
2019-11-15 23:26:29 +01:00
/**
* Module Name: Related posts
2025-07-27 19:58:08 +02:00
* Module Description: Automatically display related articles to keep visitors reading longer.
2019-11-15 23:26:29 +01:00
* First Introduced: 2.9
* Sort Order: 29
* Recommendation Order: 9
* Requires Connection: Yes
* Auto Activate: No
* Module Tags: Recommended
* Feature: Engagement
2023-09-26 10:24:36 +02:00
* // phpcs:ignore WordPress.WP.CapitalPDangit.MisspelledInComment
2023-12-07 09:44:11 +01:00
* 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
2019-11-15 23:26:29 +01:00
*/
class Jetpack_RelatedPosts_Module {
/**
* Class variables
2022-06-16 14:01:47 +02:00
*
* @var Jetpack_RelatedPosts_Module
2019-11-15 23:26:29 +01:00
*/
2022-06-16 14:01:47 +02:00
private static $instance = null;
2019-11-15 23:26:29 +01:00
/**
* Singleton implementation
*
* @return object
*/
public static function instance() {
2022-06-16 14:01:47 +02:00
if ( ! is_a( self::$instance, 'Jetpack_RelatedPosts_Module' ) ) {
self::$instance = new Jetpack_RelatedPosts_Module();
}
2019-11-15 23:26:29 +01:00
2022-06-16 14:01:47 +02:00
return self::$instance;
2019-11-15 23:26:29 +01:00
}
/**
* Register actions and filters
*
* @uses add_action, add_filter
*/
private function __construct() {
add_action( 'jetpack_module_loaded_related-posts', array( $this, 'action_on_load' ) );
}
/**
* This action triggers if the module is in an active state, load related posts and options.
*
* @uses Jetpack_RelatedPosts::init, is_admin, Jetpack::enable_module_configurable, Jetpack_Sync::sync_posts
*/
public function action_on_load() {
2022-04-02 10:26:41 +02:00
require_once __DIR__ . '/related-posts/jetpack-related-posts.php';
2019-11-15 23:26:29 +01:00
Jetpack_RelatedPosts::init();
if ( is_admin() ) {
Jetpack::enable_module_configurable( __FILE__ );
}
// Load Customizer controls.
2021-07-23 11:58:50 +02:00
if ( class_exists( WP_Customize_Manager::class ) && class_exists( WP_Customize_Control::class ) ) {
2022-04-02 10:26:41 +02:00
require_once __DIR__ . '/related-posts/class.related-posts-customize.php';
2019-11-15 23:26:29 +01:00
}
}
}
// Do it.
Jetpack_RelatedPosts_Module::instance();