PHP code example of ernilambar / wp-related-posts
1. Go to this page and download the library: Download ernilambar/wp-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/ */
ernilambar / wp-related-posts example snippets
if ( file_exists( get_parent_theme_file_path( 'vendor/autoload.php' ) ) ) {
use Nilambar\WPRelatedPosts\RelatedPosts;
$args = array(
'number' => 3,
'taxonomies' => array( 'post_tag' ),
);
$related_posts = RelatedPosts::posts( get_the_ID(), $args );