Git Product home page Git Product logo

contextual-related-posts's Introduction

Contextual Related Posts

WordPress Plugin Version

WordPress Plugin Version License WordPress Tested Required PHP Active installs

Requires: 6.2

Tested up to: 6.5

Requires PHP: 7.4

License: GPL-2.0+

Plugin page: Contextual Related Posts home page | WordPress.org listing

Related posts for your WordPress site with inbuilt caching. Supports blocks, shortcodes, widgets and custom post types!

Description

Contextual Related Posts is a powerful WordPress plugin that helps you increase your site's engagement by displaying a list of related posts that are relevant and interesting to your readers.

Contextual Related Posts uses a smart algorithm that analyzes the title and/or content of your posts to find the most related ones. This way, you can show your visitors more of your awesome content and keep them on your site longer.

Contextual Related Posts also comes with many features and options that let you customize the look and feel of the related posts list. You can choose between different styles, layouts, thumbnails, excerpts, and more. You can also use widgets, shortcodes, Gutenberg blocks, or REST API to display the related posts anywhere on your site or in your feed.

With Contextual Related Posts, you can easily boost your site's traffic, reduce bounce rates, and refresh old entries. It's fast, flexible, and easy to use. Try it today and see the difference for yourself!

Key features

  • Automatic: Just activate the plugin and Contextual Related Posts will automatically display related posts on your site and feed after the content. No need to edit any template files.
  • Manual install: If you want more control over the placement of the related posts, you can use the FAQ to learn about the functions available for manual install.
  • Gutenberg / Block Editor support: You can easily add a block called "Related Posts [CRP]" to any post or page, with its own set of options and settings.
  • Widgets: Add related posts to any widgetized area of your theme, such as the sidebar or footer. You can configure the widget options to suit your needs.
  • Shortcode: Use [crp] to display the related posts anywhere within the post content.
  • REST API: Fetch related posts for any post ID using contextual-related-posts/v1/posts/<id>/. You can also use query parameters to filter or sort the results.
  • The algorithm: Find related posts based on the title and/or content of the current post. You can also find posts by tags, categories and selected custom fields.
  • Caching: Related posts output is automatically cached as visitors browse through your site, reducing the load on your server and improving performance.
  • Exclusions: Exclude posts from certain categories or tags from being displayed in the related posts list. Or you can exclude specific posts or pages by ID using a meta box in the edit screen.
  • Custom post types: The related posts list supports posts, pages, attachments, or any other custom post type that you have on your site.
  • Thumbnail support: Display thumbnails or not!
  • Styles: The output of the related posts list is wrapped in CSS classes that allow you to easily style it using custom CSS code. You can enter your custom CSS code from within the WordPress admin area or use one of the default styles included with the plugin.
  • 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 enhances your experience with an advanced query block, offering more precise customisation options, additional shortcode functionalities, and enhanced meta box settings.

  • Advanced Algorith: 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: 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: Additional parameters for the shortcode that allow you to customise the output of the related posts list.
  • Additional Metabox settings: 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). 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.

YOU ARE RESPONSIBLE FOR ENSURING THAT ALL GDPR REQUIREMENTS ARE MET ON YOUR WEBSITE.

Donations

I spend a significant amount of my free time maintaining, updating and more importantly supporting this plugin. Those who have sought support in the support forums know that I have done my best to answer your question and solve your problem. If you have been using this plugin and find this useful, do consider making a donation. This helps me pay for my hosting and domains.

Translations

Contextual Related Posts is available for translation directly on WordPress.org. Check out the official Translator Handbook to contribute.

Screenshots

General Options Contextual Related Posts - General Options

More screenshots are available on the WordPress plugin page

Other plugins by WebberZone

Contextual Related Posts is one of the many plugins developed by WebberZone. Check out our other plugins:

  • Top 10 - Track daily and total visits on your blog posts and display the popular and trending posts
  • WebberZone Snippetz - The ultimate snippet manager for WordPress to create and manage custom HTML, CSS or JS code snippets
  • Knowledge Base - Create a knowledge base or FAQ section on your WordPress site
  • Better Search - Enhance the default WordPress search with contextual results sorted by relevance
  • Auto-Close - Automatically close comments, pingbacks and trackbacks and manage revisions
  • Popular Authors - Display popular authors in your WordPress widget
  • Followed Posts - Show a list of related posts based on what your users have read

Installation

WordPress install (the easy way)

  1. Navigate to Plugins within your WordPress Admin Area
  2. Click "Add new" and in the search box enter "Contextual Related Posts"
  3. Find the plugin in the list (usually the first result) and click "Install Now"

Manual install

  1. Download the plugin
  2. Extract the contents of contextual-related-posts.zip to wp-content/plugins/ folder. You should get a folder called contextual-related-posts.
  3. Activate the Plugin in WP-Admin under the Plugins screen

Frequently Asked Questions

Check out the FAQ on the plugin page or the Knowledge Base.

If your question isn't listed there, please create a new post at the WordPress.org support forum. It is the fastest way to get support as I monitor the forums regularly.

Support for products sold and distributed by WebberZone is only available for those who have an active, paid extension license. You can access our support form here.

How can I report security bugs?

You can report security bugs through the Patchstack Vulnerability Disclosure Program. The Patchstack team help validate, triage and handle any security vulnerabilities. Report a security vulnerability.

contextual-related-posts's People

Contributors

ajaydsouza avatar astappiev avatar ideag avatar jnorell avatar lenonleite avatar thecodeassassin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

contextual-related-posts's Issues

Caching does not differentiate between feed and web

First of all: Thanks for the great plugin! :)

We've been experiencing a maddening issue, though: Every now and then crp would output the wrong number of posts and would also ignore images. Clearing the cache usually resolved the issue - until it appeared on a different post again.

I believe the root cause of this is that the caching mechanism does not differentiate between web and feed view. We had different settings for each. Now that we made sure that the settings are identical, the issue has not appeared again (yet).

strict_limit by default should be TRUE

strict_limit option is currently false. This isn't good for user experience because when setting a specific limit for the API, the user / developer would expect the exact number of posts to be pulled. Instead the plugin returns 3x posts where available.

First image of post regex too greedy

Hi,

First of all: thanks for writing the plugin!

I came across a bug in version 2.0.1 where the regex for the first post image is set too greedy. This results in the regex always returning the url of the last image of the post, instead of the first.

A working regex is (added 2 x '?'): /<img.+?src=[\'"]([^\'"]+)[\'"].*?>/i

The bug can be found in the file contextual-related-posts.php on line 1145.

Filter for link attributes

Link attributes should be an array that can be filtered. This allows a developer to:

a) Change Target attribute
b) Change Nofollow attribute
c) Add more attributes

Exclude this post from results

Add a new option in the meta box to exclude the current post from related posts results. Ideal if you are sure you don't want a post to be included and avoid putting in an exclude ID every time in the settings page.

Show if Index exists

Add a notice in case the FULLTEXT index doesn't exist and offer to create it.

Limit to same Post Type

Add a new option under List Tuning options to limit the related posts to the same post type.

First image isn't properly resized

As reported in this WordPress thread: https://wordpress.org/support/topic/thumbnail-not-square-and-not-centered-vertically?replies=14#post-6754677

Appears that when pulling the first image URL, the plugin doesn't pick the correctly resized thumbnail.
Potential fix would be to guess the attachment ID from the URL and then find the thumbnail.

Sample code to get Attachment ID from the URL:
http://philipnewcomer.net/2012/11/get-the-attachment-id-from-an-image-url-in-wordpress/

Limit post title length (in characters) can't work well

If the original post title length shorter than the number that I set, It works well. But if longer than the number,then the post title cutted only output ... , in Chinese.

the numer I set is 36

The issue shows in the below attach file.

2016-09-21_194358
2016-09-21_194103

myISAM vs. InnoDB

Add a new setting to let a person choose between InnoDB vs. myISAM for the wp_posts table.

Turn Metabox off

Option to:

a) Turn the metabox off
b) Limit the metabox display only to admins

Include / exclude posts i.e.manual posts

Add two new options in the meta box on Edit posts / post types page to:

a) Add a set of post IDs that will be used first before related posts
b) Add a set of post IDs that will always be excluded from the related posts

This will allow the "Manual posts" option

Stop words

New option to create a set of stop words that will be removed from a post title / content when matching posts.

Better usability with default styles

Currently when saving default styles, it doesn't clearly illustrate that certain options like thumbnail width / height, author and excerpt settings, etc.

This is visible under custom styles but not elsewhere.

Propose to add a notice when saving options in case default styles are enabled.

Index Created from Content Body Are Mostly Duplicates

So I just moved to Ubuntu 16.04 on AWS (from Linode), and I noticed that many posts showed the same exact content in the related posts area. It's basically the same few recommendations over and over, where before it was doing BEAUTIFUL recommendations that were different for each page.

I have the option enabled to use the content as part of the index, and when I disable that it works, but the matches are far lower quality.

Any ideas what would cause the inability to create a good index off of post content? Have you seen this issue before?

Examples of pages on the site are:

Notice that they all have My Vim Primer, InfoSec Career Post, InfoSec Interview Questions, etc. as results, where in the past they were perfectly customized based on the content.

I'll send you $50 if you can fix this for me today.

Random posts

If there are not enough posts found, then complete the list of related posts by selecting random posts.

500 error on activate

Happens particularly with big blogs where php times out when trying to create the index. Suggest add an extra check which will see if more than 5000 (to be verified) posts and then not create the fulltext index on activation.

Separate cache for https

Using the same cache for https and http causes potential conflicts at times, especially when the SSL certificate is not validated.

Also, you don't want to show http links when a user is on an https page

Thumbnail CSS and custom size bug.

As mentioned here: https://wordpress.org/support/topic/cannot-modify-image-thumbnail-sizes-bug-with-custom-size

You should be able to reproduce at least the second error by

  • choosing a custom thumb size
  • going back to a regular / standard size from the radio choices

I also tried to clear the custom width & height boxes completely but upon saving they are showing "0px" and thus my images are being displayed as if I am using the custom size (although I am not).

The code that is being generated:

<img src="/cs/wp-content/uploads/2011/02/Fotolia_22270703_XS-150x150.jpg" alt="some-alt-text" title="some-title" style="max-width:0px;max-height:0px;" class="crp_thumb crp_firstchild">

Call to undefined function crp_single_activate()

If you press the Recreate Index button, an error occurs.
Plugin is not working in the front-end.
Message text on pluginpage (/wp-admin/options-general.php?page=crp_options):
Fatal error: Call to undefined function crp_single_activate() in /usr/local/www/apache22/data/wp-content/plugins/contextual-related-posts/admin/admin.php on line 229

Breakdown archives

Replace the Other archives option into futher options. For reference, these are the various options that set is_archive true.

  • is_category
  • is_tag
  • is_post_type_archive
  • is_date
  • is_author
  • is_tax

Separate table for Index

Create a new table with the necessary indexes instead of using the default wp_posts table. This will allow the wp_posts table to remain untouched.

Provide queries to run in case of failed Recreate Index

Recreate Index fails when a blog has too many posts due to PHP time outs. Provide a user with a list of copy-pasteable queries they can run in phpMyAdmin or Adminer

Optionally prompt to install Adminer WordPress plugin.

Initialisation of default image

Sometimes the default image doesn't get selected correct during activation because the $crp_url variable is not declared.

Fix it by specifying the full URL under crp_default_options

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.