I want to separate "Incoming Objects" for every Related Post field.

This topic is: resolved
Viewing 7 posts - 1 through 7 (of 7 total)
Author Posts
May 28, 2013 at 2:38 pm #3093
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?

May 28, 2013 at 2:59 pm #3094
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!)

May 28, 2013 at 3:03 pm #3095
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.

May 28, 2013 at 6:42 pm #3096
aguko
Post count: 43

Since I have taken relation by the same custom post altogether, I am satisfied with #3094 answer.

Thanks!

May 29, 2013 at 8:52 am #3106
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.

May 29, 2013 at 9:35 am #3107
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 …

June 8, 2013 at 11:24 am #3174
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”)

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.

Latest From the Blog

MasterPress 1.4.1 is now available

27th May 2024

This update addresses backwards compatibility issues that were introduced in the previous update. There were some edge cases where PHP 7 had issues and it didn’t work at all on PHP 5.6.We have now changed it so that the PHP 8 compatibility changes will now only affect PHP 8 and will be more thorough with… 

Plugin Requirements

MasterPress requires a minimum of WordPress version 4.9, MySQL 5.6, and PHP version 5.6.20.

We also recommend that PHP is configured to use a memory limit of 64MB per request (128MB may be required for sites with higher complexity).

This plug-in is not compatible with the WordPress.com hosted service.

Three AM