Contextual Related Posts v3.2.1
I’m pleased to announce that Contextual Related Posts v3.2.0 has been released and is available for download/upgrade from within your WordPress Dashboard. This release brings several new features and some enhancements. As always, please create a new post in the support forum to report bugs or seek support.
Primary category or term
v3.2.0 introduces a new option called Limit to primary category which you can find under the List tuning tab. This is the most aggressive of limiting settings vs the other Only from options that you’ll also find on the same tab. With this option activated, the related posts are narrowed down to only find other related posts from the primary category.
WordPress doesn’t have this built in and hence this is typically set by your SEO plugin. Contextual Related Posts checks if either Yoast, Rank Math, The SEO Framework or SEOPress are active. If none of these are active, the plugin will pick the first category provided by get_the_terms()
.
In addition to this option, you can now also choose to display the primary category. Select Show primary category/term in the Output tab. This works great for the Grid style and wouldn’t work well with the other styles.
CSS changes
I have made modifications to the HTML output and the CSS that is included for the various styles. Firstly, the main div
will always include crp_related
class. Previously, widgets didn’t have this class. Secondly, if you select a particular style e.g. rounded thumbs, then an additional class is included, which in this case would be crp-rounded-thumbs
.
All stylesheets have been updated to have more specific declarations e.g. .crp_related.crp-rounded-thumbs
. I strongly recommended clearing the cache of the plugin as well as any other external caches to ensure your plugin displays a seamless output.
Exclude (on) categories
Exclude categories and Exclude on categories have been renamed to Exclude terms and Exclude on terms as these two options now support all taxonomies. Both these fields support autocomplete when you start typing. The fields now say with the format “Term Name (taxonomy:term_taxonomy_id)”. If you resave your settings page, your old settings will automatically be migrated.
Widget changes
On a separate change, the widget’s Only from categories option will no longer autocomplete and you’ll need to use a set of term taxonomy IDs instead. Unfortunately, the various changes to WordPress meant that I was never able to get this to work properly.
Additionally, the widget will no longer display the heading if there are no related posts found. Previously, you’d see a blank heading and nothing else if you had not selected a custom output to display.
Exclude post IDs in metabox
You’ll find a new option in the metabox which is displayed at the bottom of Edit screens where you can enter a comma-separated list of post IDs that you want to exclude. When saving the post, the plugin will validate these posts and remove any incorrect IDs or unpublished post IDs.
Note that the metabox doesn’t refresh automatically when you’re saving the post so you’ll need to reload the page to view the validated list of post IDs.
Complete set of changes in Contextual Related Posts v3.2
v3.2.2
- Bug fix:
- Widget options were not saved properly
- Stylesheets and header styles have been fixed to be more specific
v3.2.1
- Enhancements/modifications:
- If thumbnail is set as
text only
, then the style is also set astext only
at runtime
- If thumbnail is set as
- Bug fix:
- PHP error thrown when using
get_crp_posts_id()
- PHP error thrown when using
- Deprecated:
get_crp_posts_id()
. Useget_crp_posts()
instead
v3.2.0
- New feature:
- New option to limit posts to the primary category/term. The plugin checks if either Yoast, Rank Math, The SEO Framework or SEOPress are active. If none of these are active, the plugin will pick the first category provided by
get_the_terms()
- New option to show the primary category/term
- New option in metabox to enter a comma-separated list of post IDs to exclude from the related posts
- New filter
crp_fill_random_posts
(default:false) which can be used to fill random posts if the number of related posts is less than the limit set
- New option to limit posts to the primary category/term. The plugin checks if either Yoast, Rank Math, The SEO Framework or SEOPress are active. If none of these are active, the plugin will pick the first category provided by
- Enhancements/modifications:
- No widget is displayed if
get_crp()
is empty i.e. no related posts are found post_title
andpost_content
fields are only used if Use content option is set- Gutenberg block updated to the latest Blocks API
- The widget’s “Only from categories” autocomplete replaced by ID list
- Wrapper
div
now always includescrp_related
class name. Stylesheets have been updated to have more specific styles e.g..crp_related.crp-rounded-thumbs
- Exclude categories and Exclude on categories renamed to Exclude terms and Exclude on terms as they now support all taxonomies and the accepted format has changed to “Term Name (taxonomy:term_taxonomy_id)”
- No widget is displayed if
- Bug fixes:
- Current post was incorrectly being excluded in the translation functions