Separate "Incoming Terms" for every Related Term field.

This topic is: resolved
Viewing 12 posts - 1 through 12 (of 12 total)
Author Posts
June 10, 2013 at 9:41 pm #3178
Avataraguko
Post count: 43

Since I have posted to the [Resolved] topic, I post a new topic.

It is a continuation of this topic.
https://www.masterpressplugin.com/support/topic/i-want-to-separate-incoming-objects-for-every-related-post-field

Can I separate for every field similarly by “incoming_terms” in custom taxonomy (at taxonomy-[custom taxonomy].php template )?

ex. $wf->the_term->incoming_terms(“for=field_set.field”)

thanks.

June 10, 2013 at 10:35 pm #3180
Avatartraversal
Post count: 207

Hi there. You should be able to do this yes. Have you tried to do this in the taxonomy-[tax_name].php template? Can you describe your field setup in a bit more detail?

Note that, if you want to use a standard WordPress “loop” in that template, you can also add “query=1” to the arguments before the standard loop code, and that should hopefully then show the correct posts.

$wf->the_term->incoming_terms(“for=field_set.field&query=1”);

if (have_posts()) : while (have_posts()) : the_post();

etc…

Thanks

June 11, 2013 at 12:34 am #3181
Avataraguko
Post count: 43

I explain something to do in detail.

I want to make the flexible relationship for every keyword using custom taxonomy.

By the category of wordpress, I cannot set two or more parents to one keyword. Then, I set “Related Terms” to custom taxonomy, and I want to be able to set two or more parents to one keyword.

I drew the figure.
https://cacoo.com/diagrams/lP4GdGERZOl7MEs3-1E6A8.png

1 ) Input a parent keyword into the “parent field” of each keyword.
2 ) Display the taxonomy-keyword.php of a parent keyword. The keyword which makes itself parents using “MEOW_Term :: incoming_terms” is displayed.
3 ) Add some values to the child field using “MPFT_RelatedTerm :: value_for_set.”

Can I realizable?

Thanks.

June 11, 2013 at 9:12 am #3182
Avatartraversal
Post count: 207

Wow, thanks for that. So do you actually need to do step 3, and store the child relationship? The children of a keyword are defined by the incoming_terms query right?

You can certainly store the reverse relationship if you want to, but it means you need to keep them in sync, which is probably a little tricky.

By the way, the value_for_set method is not intended to be called directly, it basically enables the fields to be set via direct assignment. Something like this should be possible:

http://pastebin.com/drYxbbm5

June 11, 2013 at 10:48 am #3184
Avataraguko
Post count: 43

Thank you for the additional method to the field.

And I want to save each child-parent relationship at DB for other purposes.
However, I was not able to separate and display on the field by “$wf->the_term->incoming_terms(“for=field_set.field”).”

Although the following codes were written at taxonomy-keyword.php, it did not display.
http://pastebin.com/YHiEhUYT

custom taxonomy: keyword
field set: relationship
field(Related Term): parent
field(Related Term): child

thanks.

June 11, 2013 at 12:35 pm #3185
Avatartraversal
Post count: 207

Okay thanks. I’ll need to setup a test environment and find out why that’s not working.

June 11, 2013 at 1:37 pm #3186
Avataraguko
Post count: 43

Thank you!

June 12, 2013 at 6:39 pm #3196
Avatartraversal
Post count: 207

Hey, I’ve just looked into this and realised that the code in http://pastebin.com/YHiEhUYT is not quite right.

The first argument for incoming_terms is actually the taxonomy name. Have you tried making the first argument in line 12 and 18 the string “keyword” to specify the keyword taxonomy?

June 13, 2013 at 1:04 am #3198
Avataraguko
Post count: 43

I referred to http://pastebin.com/Y0B7qd78, and described it.

How should I specify the first argument in this case?

June 13, 2013 at 10:07 am #3200
Avatartraversal
Post count: 207

Hi. Here is the reference in the class documentation:

https://www.masterpressplugin.com/docs/developer/methods/meow-term-incoming-terms

It should be something like this:

http://pastebin.com/0gPGAGr4

Let me know if that works. Thanks

June 13, 2013 at 10:29 am #3201
Avataraguko
Post count: 43

I was able to display for every field!

“Incoming” is a wonderful function.

Thank you very much!

June 13, 2013 at 10:34 am #3202
Avatartraversal
Post count: 207

Great. I’m really glad that does actually work!

The “Incoming” functions are really nice – the queries running behind them are quite difficult, so it’s good that you don’t need to worry about that.

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

You must be logged in to reply to this topic.

Latest From the Blog

MasterPress 1.2.8 is now available

It was brought to our attention that MasterPress would give a tonne of warnings and deprecation notices when used with PHP 7.4 – this update addresses those.

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