This WordPress plugin tracks and displays recently viewed posts while ensuring GDPR compliance with the Complianz plugin. It securely stores the post IDs in local storage and cookies, allowing users to see their recently viewed posts.
Moritz Reitz
Email: [email protected]
GitHub: Moreit11
- Tracks recently viewed posts.
- Complies with GDPR using Complianz for user consent.
- Securely stores post information in local storage and cookies.
- Supports multiple post types.
- Download the plugin files and unzip them.
- Upload the
complianz-recently-viewed-posts
folder to the/wp-content/plugins/
directory. - Activate the plugin through the 'Plugins' menu in WordPress.
- Ensure that the Complianz plugin is also installed and configured to manage cookie consent.
To display recently viewed posts on your site, use the following shortcode in any post or page:
[recently_viewed_posts]
To track and display your own custom post types:
- Open the
your-plugin.php
file. - Locate the
WP_Query
section inside thecrvp_display_recently_viewed_posts
function. - Change the
'post_type' => 'any'
line to include your custom post type(s), for example:'post_type' => array('your_custom_post_type', 'another_post_type')
- Save the changes and refresh your site.
This plugin checks for user consent using the Complianz plugin. If you are using other cookie consent management plugins or services, you may need to modify the hasConsentForStatisticsOrMarketing
function to align with their consent checks.
If using a different plugin, update the consent checking function as follows:
function hasConsentForStatisticsOrMarketing() {
// Example for a different plugin
return isset($_COOKIE['another_plugin_cookie']) && $_COOKIE['another_plugin_cookie'] === 'allow';
}
- The plugin ensures all user data is sanitized and validated.
- Cookies are set with the
Secure
,HttpOnly
, andSameSite=Strict
attributes for enhanced security.
This plugin is licensed under the MIT License.
For support, please contact: [email protected]