John
John

Reputation: 393

Wordpress display related articles on page

I currently have a custom page in Wordpress (with the PHP Execution plugin). On this page I'm displaying dynamic content, and I would like to be able to show, at the bottom of this page, a dynamic list of related Wordpress articles. I'm currently using Similar Posts, but since my page doesn't have any tags (I assume this is why it doesn't work), it doesn't show any related articles. Is there any easy solution for this?

Edit: I was thinking about another way to solve my problem - to display a short list of the articles that share the same tag. For example, on my website www.domain.com/tag/same-tag would display a list of articles that contain a tag "same-tag". Is there any way to display 5 or so of these articles (I would only be using article titles and author) ?

Upvotes: 0

Views: 608

Answers (1)

Gediminas
Gediminas

Reputation: 864

It is easy to show pages with the same tag. First of all, you should get current post tags using wp_get_post_tags When you have it, select pages with the same tags using WP_Query. Don't forget to exclude current page. In order to select random related pages set orderby to rand at WP_Query.

Upvotes: 1

Related Questions