Maybe someone can help to make related posts with custom posts type? I am stuck with that... Code is here:
For example:
We are in current post:
ID | title | cust_category | cust_names | cust_settings
1 | X1 | cat1, cat3 | name8 | set1, set5
And we have customs posts:
ID | title | cust_category | cust_names | cust_settings
2 | X4 | cat1 | name9 | set2
3 | X1 | cat1, cat3 | name9 | set5
4 | X8 | cat12 | name12 | set12
So related posts to current post (ID = 1) will be:
ID 3 and ID 2.
ID3 is the most related, because it has the same values - X1, cat1, set5 (related 3 values).
ID 2 is also related by one value - cat1.
Or you can see this explanation in image:
Maybe someone can help to make related posts with custom posts type? I am stuck with that... Code is here: https://pastebin/zRVjuMBn
For example:
We are in current post:
ID | title | cust_category | cust_names | cust_settings
1 | X1 | cat1, cat3 | name8 | set1, set5
And we have customs posts:
ID | title | cust_category | cust_names | cust_settings
2 | X4 | cat1 | name9 | set2
3 | X1 | cat1, cat3 | name9 | set5
4 | X8 | cat12 | name12 | set12
So related posts to current post (ID = 1) will be:
ID 3 and ID 2.
ID3 is the most related, because it has the same values - X1, cat1, set5 (related 3 values).
ID 2 is also related by one value - cat1.
Or you can see this explanation in image:
P.S. In this project I use ONLY the same custom post type. No simple posts and other. Just "custom_post_name" customs posts. Nothing else. I am trying to make it work about few weeks. Please help me. As I understand I need only a good query and that is it. I am very beginner in WP.