aguko
Post count: 43
|
I created three Field Sets and have set Related Post field to each.
And I displayed related posts according to the Code Recipes (https://www.masterpressplugin.com/docs/developer/recipes/incoming-objects) using “Incoming Objects.” However, the related post became together and was displayed.
I want to separate “Incoming Objects” for every Related Post field.
Are there any methods?
|
traversal
Post count: 207
|
There is a way to do this, but this isn’t currently documented correctly – sorry!
The MEOW_Post::incoming method (https://www.masterpressplugin.com/docs/developer/methods/meow-post-incoming) actually supports another argument “for”, which lets you specify a list of post meta keys for the custom fields you want to regard in the query.
Try this:
http://pastebin.com/Y0B7qd78
(the code has instructions in the comments, hopefully it makes sense!)
|
traversal
Post count: 207
|
Actually, sorry, that example is slightly unrealistic, but hopefully you get the idea. You need to specify the correct post meta key for the field you want to include.
You may also need to specify a “post_type” in the query if you happened to have multiple custom fields with the same meta key.
|
aguko
Post count: 43
|
Since I have taken relation by the same custom post altogether, I am satisfied with #3094 answer.
Thanks!
|
traversal
Post count: 207
|
Great, I’m glad you were able to get it working! The “for” argument was built exactly for this reason, I had the same problem myself at one stage. The “incoming” series of methods are very nice to use I think, certainly a lot easier than building the queries yourself.
|
aguko
Post count: 43
|
I also agree.
I think that “incoming” is the feature which is not in ACF or Types.
Management is easy above all.
Podsframework is difficult to manage for me …
|
aguko
Post count: 43
|
Can I separate for every field similarly by “incoming_terms” in custom taxonomy?
ex. $wf->the_term->incoming_terms(“for=field_set.field”)
|