PHP code example of helick / related-posts

1. Go to this page and download the library: Download helick/related-posts library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

helick / related-posts example snippets

 php
$postIds = Helick\RelatedPosts\get(int $postId, array $args = []);
 php
add_filter('helick_related_posts_supported_post_types', function (array $postTypes) {
    $postTypes[] = 'your-custom-post-type';

    return $postTypes;
});
 php
add_filter('helick_related_posts_associated_post_types', function (array $postTypes) {
    $postTypes[] = 'your-custom-post-type';

    return $postTypes;
});