diff --git a/README.md b/README.md index 1502f46..8b38ae0 100644 --- a/README.md +++ b/README.md @@ -8,9 +8,9 @@ [![Required PHP](https://img.shields.io/wordpress/plugin/required-php/contextual-related-posts?style=flat-square)](https://wordpress.org/plugins/contextual-related-posts/) [![Active installs](https://img.shields.io/wordpress/plugin/installs/contextual-related-posts?style=flat-square)](https://wordpress.org/plugins/contextual-related-posts/) -__Requires:__ 5.9 +__Requires:__ 6.2 -__Tested up to:__ 6.4 +__Tested up to:__ 6.5 __Requires PHP:__ 7.4 @@ -47,12 +47,25 @@ With Contextual Related Posts, you can easily boost your site's traffic, reduce * __Customisable output__: Display post excerpts in the related posts list. You can set the length of the excerpt in words and also strip HTML tags if needed. Customise the HTML tags and attributes used for displaying the output of the related posts list. For example, you can use an ordered or unordered list, a div container, a span element, etc. * __Extendable code__: Contextual Related Posts has many filters and actions that allow developers to easily add features, modify outputs, or integrate with other plugins. +### Features in Contextual Related Posts Pro + +[CRP Pro](https://webberzone.com/plugins/contextual-related-posts/pro/) enhances your experience with an advanced query block, offering more precise customisation options, additional shortcode functionalities, and enhanced meta box settings. + +* [Advanced Algorith](https://webberzone.com/support/knowledgebase/contextual-related-posts-algorithm/): Set the relative weight of the post title, post content and post excerpt. This feature overrides the default equal weight algorithm of the free version and provides a greater degree of fine-tuning. +* [Query Loop Block](https://webberzone.com/support/knowledgebase/contextual-related-posts-blocks/#contextual-related-posts-query-loop-block): An advanced block that allows you to display the related posts based on specified parameters. You can use the pre-built block patterns or create your own block patterns for use within posts or the site editor. +* [Extra shortcode parameters](https://webberzone.com/support/knowledgebase/contextual-related-posts-shortcode/): Additional parameters for the shortcode that allow you to customise the output of the related posts list. +* [Additional Metabox settings](https://webberzone.com/support/knowledgebase/contextual-related-posts-metabox/): Additional settings in the post edit screen that allow you to customise the related posts output for each post. + ### mySQL FULLTEXT indices -On activation, the plugin creates three mySQL FULLTEXT indices (or indexes) that are then used to find the related posts in the `*_posts`. These are for `post_content`, `post_title` and `(post_title,post_content)`. If you're running a multisite installation, then this is created for each of the blogs on activation. All these indices occupy space in your mySQL database but are essential for the plugin to run. +On activation, the plugin creates three mySQL FULLTEXT indices (or indexes) that are then used to find the related posts in the `*_posts`. These are for `post_content`, `post_title` and `(post_title,post_content)`. The Pro version also has an index for `post_excerpt`. + +If you're running a multisite installation, then this is created for each of the blogs on activation. All these indices occupy space in your mySQL database but are essential for the plugin to run. You have two sets of options in the settings page which allows you to remove these indices when you deactivate or delete the plugin. The latter is true by default. +If you do not wish to use these indices, you can disable contextual matching in the settings page. You will need to turn on related posts by category, tags and/or custom taxonomies. + ### GDPR Contextual Related Posts is GDPR compliant as it doesn't collect any personal data about your visitors when installed out of the box. All posts are processed on your site and not sent to any external service. diff --git a/changelog.txt b/changelog.txt index bf8e77a..a760094 100644 --- a/changelog.txt +++ b/changelog.txt @@ -2,6 +2,74 @@ This is an archive of older changelog entries. Most recent entries are maintained in readme.txt += 3.4.1 = + +* Bug fix: + * Fixed Request-URI Too Long error when searching for pages/posts + * Related Posts block threw an error when using on the widgets page + += 3.4.0 = + +* Features: + * Bulk edit posts, pages and custom post types to add the manual relatd posts and/or exclude posts from the related posts list + * New argument `include_words` to include posts that match the words in the title and/or content. + +* Enhancements/Modifications: + * The Manual Related Posts field in the meta box allows a user to live search for related posts + * Caching of the entire HTML output is enabled by default. You can disable it in the settings page. This will reduce the number of database queries and improve performance. If you have customised the output, you will need to clear the cache for the changes to take effect. Applies to new installs and when you reset the settings + * The plugin no longer check for pre v2.5 settings key + * The Media Handler will check the title of the image in case the alt tag text is empty before defaulting to the post title + * All the inbuilt styles have been updated for the `a` tags to have `:focus-visible` declared for accessibility + * The `Heading of posts` setting will now use `

` instead of `

` for the heading by default + +* Bug Fixes: + * The post cache was not always cleared when a post was updated + +* Deprecated: + * `get_crp_posts_id` has been completed deprecated and will use `get_crp_posts` instead. The function will continue to work but will be removed in a future version + += 3.3.4 = + +Release post: [https://webberzone.com/blog/contextual-related-posts-v3-3-0/](https://webberzone.com/blog/contextual-related-posts-v3-3-0/) + +* Enhancements/Modifications: + * When displaying the post thumbnail, the Media Handler will first use the image's alt tag set in the Media editor. If alt tag is empty, then it will use the post title as a fallback. Filter `crp_thumb_use_image_alt` and set it to false to not use the alt tag. Filter `crp_thumb_alt_fallback_post_title` and set it to false to disable the alt tag + * Orderby clause modified to ensure compatibility if any other plugin rewrites the WP_Query fields + +* Bug Fixes: + * Fix duplicate display of related posts when using reusable blocks or a plugin that inserts pages + * `meta_query` argument was ignored + += 3.3.3 = + +* Fixes permission issues with HTML settings + += 3.3.2 = + +* Clearing cache security fix + += 3.3.1 = + +* Security fix in block + += 3.3.0 = + +* Features: + * Related posts block allows you to set a custom header above the related posts. Leave blank to get the one from the main settings page. + * New option "Related Meta Keys" under the List Tuning tab. You can enter a comma-separted list of meta keys. Posts that match the same value of the meta key are displayed before the other related posts. + +* Enhancements/modifications: + * If the number of "Manual related posts" is greater than the number of related posts, then the database query is bypassed drastically improving perfomance + * Moved Related Posts Tools page under Tools menu + * Related Posts block is now wrapped in `Disabled` tags to prevent accidental clicking of links in the block editor + +* Bug fixes: + * Thumb width and height defaults to 150 in case the settings are missing + * Setting the style to be text_only didn't enforce no thumbnail + +* Developer: + * New filters: `crp_query_date_query`, `crp_query_meta_query`, `crp_query_meta_query_relation` + = 3.2.3 = Release post: [https://webberzone.com/blog/contextual-related-posts-v3-2-0/](https://webberzone.com/blog/contextual-related-posts-v3-2-0/) diff --git a/composer.json b/composer.json index f568aa8..04f8f36 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,7 @@ { "name": "webberzone/contextual-related-posts", "description": "Add related posts to your WordPress site with inbuilt caching. Supports thumbnails, shortcodes, widgets and custom post types!", + "version": "3.5.0", "type": "wordpress-plugin", "keywords": [ "related posts", diff --git a/contextual-related-posts.php b/contextual-related-posts.php index 0449ae7..f154de6 100644 --- a/contextual-related-posts.php +++ b/contextual-related-posts.php @@ -12,10 +12,10 @@ * @copyright 2009-2024 Ajay D'Souza * * @wordpress-plugin - * Plugin Name: Contextual Related Posts + * Plugin Name: Contextual Related Posts Pro * Plugin URI: https://webberzone.com/plugins/contextual-related-posts/ * Description: Display related posts on your website or in your feed. Increase reader retention and reduce bounce rates - * Version: 3.5.0-beta4 + * Version: 3.5.0-beta5 * Author: WebberZone * Author URI: https://webberzone.com * License: GPL-2.0+ @@ -23,7 +23,8 @@ * Text Domain: contextual-related-posts * Domain Path: /languages * GitHub Plugin URI: https://github.com/WebberZone/contextual-related-posts/ - */ + * + */ namespace WebberZone\Contextual_Related_Posts; @@ -102,28 +103,17 @@ // Load the autoloader. require_once CRP_PLUGIN_DIR . 'includes/autoloader.php'; -/** - * The code that runs during plugin activation. - * - * @since 3.5.0 - * - * @param bool $network_wide Whether the plugin is being activated network-wide. - */ -function activate( $network_wide ) { - \WebberZone\Contextual_Related_Posts\Admin\Activator::activation_hook( $network_wide ); -} -register_activation_hook( __FILE__, __NAMESPACE__ . '\activate' ); - -/** - * The main function responsible for returning the one true WebberZone Snippetz instance to functions everywhere. - * - * @since 3.5.0 - */ -function load() { - \WebberZone\Contextual_Related_Posts\Main::get_instance(); +if ( ! function_exists( __NAMESPACE__ . '\load' ) ) { + /** + * The main function responsible for returning the one true WebberZone Snippetz instance to functions everywhere. + * + * @since 3.5.0 + */ + function load() { + \WebberZone\Contextual_Related_Posts\Main::get_instance(); + } + add_action( 'plugins_loaded', __NAMESPACE__ . '\load' ); } -add_action( 'plugins_loaded', __NAMESPACE__ . '\load' ); - /* *---------------------------------------------------------------------------- diff --git a/includes/admin/images/contextual-related-posts-pro-banner.jpg b/includes/admin/images/contextual-related-posts-pro-banner.jpg deleted file mode 100644 index 1b279f4..0000000 Binary files a/includes/admin/images/contextual-related-posts-pro-banner.jpg and /dev/null differ diff --git a/includes/admin/images/crp-pro-banner.png b/includes/admin/images/crp-pro-banner.png new file mode 100644 index 0000000..ccff793 Binary files /dev/null and b/includes/admin/images/crp-pro-banner.png differ diff --git a/includes/admin/images/x.png b/includes/admin/images/x.png index 2c2d7e8..4ad8abf 100644 Binary files a/includes/admin/images/x.png and b/includes/admin/images/x.png differ diff --git a/includes/admin/settings/sidebar.php b/includes/admin/settings/sidebar.php index 8d31c5c..c96f3a2 100644 --- a/includes/admin/settings/sidebar.php +++ b/includes/admin/settings/sidebar.php @@ -9,14 +9,15 @@ ?>
- is_not_paying() ) { ?> + is_paying() ) { ?>
- <?php esc_html_e( 'Contextual Related Posts Pro - Coming soon. Sign up to find out more', 'contextual-related-posts' ); ?> + <?php esc_html_e( 'Contextual Related Posts Pro - Coming soon. Sign up to find out more', 'contextual-related-posts' ); ?>
+ is_paying() ) { ?>

@@ -37,6 +38,7 @@
+

diff --git a/includes/class-main.php b/includes/class-main.php index 3a79668..5f6d409 100644 --- a/includes/class-main.php +++ b/includes/class-main.php @@ -7,12 +7,11 @@ namespace WebberZone\Contextual_Related_Posts; +use WebberZone\Contextual_Related_Posts\Admin\Activator; use WebberZone\Contextual_Related_Posts\Frontend\Display; - if ( ! defined( 'WPINC' ) ) { exit; } - /** * Main plugin class. * @@ -92,7 +91,6 @@ public static function get_instance() { self::$instance = new self(); self::$instance->init(); } - return self::$instance; } @@ -115,9 +113,7 @@ private function init() { $this->styles = new Frontend\Styles_Handler(); $this->shortcodes = new Frontend\Shortcodes(); $this->blocks = new Frontend\Blocks\Blocks(); - $this->hooks(); - if ( is_admin() ) { $this->admin = new Admin\Admin(); } @@ -136,7 +132,12 @@ public function hooks() { add_filter( 'the_excerpt_rss', array( $this, 'content_filter' ), \crp_get_option( 'content_filter_priority' ) ); add_filter( 'the_content_feed', array( $this, 'content_filter' ), \crp_get_option( 'content_filter_priority' ) ); add_action( 'parse_query', array( $this, 'parse_query' ) ); - add_action( 'activated_plugin', array( $this, 'deactivate_other_instances' ) ); + add_action( + 'activated_plugin', + array( $this, 'activated_plugin' ), + 10, + 2 + ); add_action( 'pre_current_active_plugins', array( $this, 'plugin_deactivated_notice' ) ); } @@ -155,8 +156,9 @@ public function initiate_plugin() { * @since 3.5.0 */ public function register_widgets() { - register_widget( '\WebberZone\Contextual_Related_Posts\Frontend\Widgets\Related_Posts_Widget' ); + register_widget( '\\WebberZone\\Contextual_Related_Posts\\Frontend\\Widgets\\Related_Posts_Widget' ); } + /** * Function to register our new routes from the controller. * @@ -198,29 +200,27 @@ public function parse_query( $query ) { * * @since 3.5.0 * - * @param string $plugin The plugin being activated. + * @param string $plugin The plugin being activated. + * @param bool $network_wide Whether the plugin is being activated network-wide. */ - public function deactivate_other_instances( $plugin ) { + public function activated_plugin( $plugin, $network_wide ) { if ( ! in_array( $plugin, array( 'contextual-related-posts/contextual-related-posts.php', 'contextual-related-posts-pro/contextual-related-posts.php' ), true ) ) { return; } - + Activator::activation_hook( $network_wide ); $plugin_to_deactivate = 'contextual-related-posts/contextual-related-posts.php'; $deactivated_notice_id = '1'; - // If we just activated the free version, deactivate the pro version. if ( $plugin === $plugin_to_deactivate ) { $plugin_to_deactivate = 'contextual-related-posts-pro/contextual-related-posts.php'; $deactivated_notice_id = '2'; } - if ( is_multisite() && is_network_admin() ) { $active_plugins = (array) get_site_option( 'active_sitewide_plugins', array() ); $active_plugins = array_keys( $active_plugins ); } else { $active_plugins = (array) get_option( 'active_plugins', array() ); } - foreach ( $active_plugins as $plugin_basename ) { if ( $plugin_to_deactivate === $plugin_basename ) { set_transient( 'crp_deactivated_notice_id', $deactivated_notice_id, 1 * HOUR_IN_SECONDS ); @@ -240,18 +240,19 @@ public function plugin_deactivated_notice() { if ( ! in_array( $deactivated_notice_id, array( 1, 2 ), true ) ) { return; } - $message = __( "Contextual Related Posts and Contextual Related Posts PRO should not be active at the same time. We've automatically deactivated Contextual Related Posts.", 'contextual-related-posts' ); if ( 2 === $deactivated_notice_id ) { $message = __( "Contextual Related Posts and Contextual Related Posts PRO should not be active at the same time. We've automatically deactivated Contextual Related Posts PRO.", 'contextual-related-posts' ); } - ?>
-

+

+ +

` instead of `

` for the heading by default - -* Bug Fixes: - * The post cache was not always cleared when a post was updated - -* Deprecated: - * `get_crp_posts_id` has been completed deprecated and will use `get_crp_posts` instead. The function will continue to work but will be removed in a future version - -= 3.3.4 = - -Release post: [https://webberzone.com/blog/contextual-related-posts-v3-3-0/](https://webberzone.com/blog/contextual-related-posts-v3-3-0/) - -* Enhancements/Modifications: - * When displaying the post thumbnail, the Media Handler will first use the image's alt tag set in the Media editor. If alt tag is empty, then it will use the post title as a fallback. Filter `crp_thumb_use_image_alt` and set it to false to not use the alt tag. Filter `crp_thumb_alt_fallback_post_title` and set it to false to disable the alt tag - * Orderby clause modified to ensure compatibility if any other plugin rewrites the WP_Query fields - -* Bug Fixes: - * Fix duplicate display of related posts when using reusable blocks or a plugin that inserts pages - * `meta_query` argument was ignored - -= 3.3.3 = - -* Fixes permission issues with HTML settings - -= 3.3.2 = - -* Clearing cache security fix - -= 3.3.1 = - -* Security fix in block - -= 3.3.0 = - -* Features: - * Related posts block allows you to set a custom header above the related posts. Leave blank to get the one from the main settings page. - * New option "Related Meta Keys" under the List Tuning tab. You can enter a comma-separted list of meta keys. Posts that match the same value of the meta key are displayed before the other related posts. - -* Enhancements/modifications: - * If the number of "Manual related posts" is greater than the number of related posts, then the database query is bypassed drastically improving perfomance - * Moved Related Posts Tools page under Tools menu - * Related Posts block is now wrapped in `Disabled` tags to prevent accidental clicking of links in the block editor - -* Bug fixes: - * Thumb width and height defaults to 150 in case the settings are missing - * Setting the style to be text_only didn't enforce no thumbnail - -* Developer: - * New filters: `crp_query_date_query`, `crp_query_meta_query`, `crp_query_meta_query_relation` = Earlier versions =