Now the AMP plugin will automatically use the template in your mobile theme folder instead of the one in the plugin folder.
Anyway, let’s get back on track.
Right click and download this text file then rename the extension to php then upload it to the amp template folder in your mobile theme folder. You can also just click on it, copy the content, paste it in a new text document and save it as related-posts.php and then upload it to your AMP template folder.
Next, copy the content of this file and paste it in the functions.php file of your mobile theme or responsive theme as the case may be then save it.
Clear your website’s cache and load an amp page. It should look like the screenshot below
To edit how many related posts are showing, simply edit line 12 ($count = 5;) in related-posts.php.
For more info about this, especially if you want to use images as well in your related posts listing, check out Add Related Posts To Accelerated Mobile Pages (AMP) in WordPress. I basically took what Isabel wrote there, tweaked it a bit to suit my taste and viola.
Got questions? The comment section is always open.
You’ll also like:
Please share this article to help others. Thanks