Please note that this article requires basic understanding of HTML and WordPress. If you’re not sure what to do, we advise you to avoid tampering with your website’s code.
Occasionally we like to endeavor on a little like-frenzy trip down our Facebook Newsfeed. We just like content – from images to articles and individual comments – without really reading further into the story.
We may happen to stumble on a particular article with an interesting title, nice picture – but still, not worth visiting or reading. Now, as creators of that article, we can control what the user will see once they like, comment or interact with our post, without leaving their Newsfeed. Much like the Related Posts section on our blog, Facebook’s related articles work in a similar way.
Today we will implement OpenGraph tags for Related Content on our WordPress articles.
Control what #Facebook shows as related content with OpenGraph.
Acquaint yourself with OpenGraph for WordPress.
This time we will be adding the see_also meta tag on our article. It contains an array<url> of links to related content, which you can define. The links can be specific articles, that is, static content. Make sure your tag is contained within an Article Object Type, otherwise this doesn’t seem to work.
WordPress is a powerful content management tool, and changing the code every so may become tedious. In this case, we can call a WP loop of related content within our tag and define our parameters from there. Just in case, take a look into WordPress’s documentation on how loops and queries work.
You need to make sure your code will go on a single.php template, or, if your header.php calls your meta, use our conditional tags instead. Otherwise, this will not work, unless you change conditions.
Essentially, every time a Facebook user interacts with our shared article on their Newsfeed, our see_also property will trigger an action to display our related permalinks ( previews of articles ) underneath the post, from the same category as our original shared article.
Would you like to add anything to this story? Share your insight with us on the comments below.