Skip Navigation

[Resuelto] Featured taxonomies

This support ticket is created hace 5 años, 9 meses. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+01:00)

Autor
Mensajes
#953106

Tell us what you are trying to do?

I have bunch of taxonomies (amenities) in 11 groups and I want to enable client to check his (choice) 10 featured amenities of his checked amenities.

My idea was to use 'termmeta' in form of single checkbox field, but I stuck. I can't see the way to display it in backend per post, what most likely mean - impossible in View in CRED (as well).

Is it wrong idea? How to do it?

#953528

Nigel
Supporter

Languages: Inglés (English ) Español (Español )

Timezone: Europe/London (GMT+01:00)

For certain taxonomies (of which there are many) you want the user to be able to specify that one of the terms is "featured".

So they will mark off several terms, and need a way to mark one of the terms as special.

That's the issue?

Well, as you can see for yourself, the UI for taxonomies in WordPress is pretty poor, and there is no ready way for you to set term meta while setting a term on a post.

But that's not a solution in any case, even if you could.

Taxonomies are the same for all posts (the difference being simply whether a term is applied or not).

Say you had a colour taxonomy, with terms such as red, yellow, and blue.

And you added a termmeta field for the hex code for the colour.

If you set the hex code for the red term to #f00 then that will be the same for every post that the red term is applied.

In your example, you can't have a termmeta of featured-for-some and not-featured-for-others.

There isn't a simple solution.

You could create a custom field which stores the slug of the featured term, so in my colour taxonomy one post might save featured-field = red and another featured-field = green.

It is then a question of how you use that information.

#953722

Thanks. That is exactly what I want:

You could create a custom field which stores the slug of the featured term, so in my colour taxonomy one post might save featured-field = red and another featured-field = green.

But, how to 'feed't that field with by user set taxonomies?

#956495

Nigel
Supporter

Languages: Inglés (English ) Español (Español )

Timezone: Europe/London (GMT+01:00)

How to populate the select field with all of the taxonomy terms so they can choose which one is featured?

You would be looking at using the wpt_field_options filter again which I described in the other ticket.

Continuing with the colour taxonomy example, I could create a select field for featured colour.

Using wpt_field_options, I could use get_terms() to retrieve the list of terms from the colour taxonomy and with it build the list of options for the select field.

https://developer.wordpress.org/reference/functions/get_terms/

#956519

I will not close topic as other two topics are kind of 'frozen'. I posted now https://toolset.com/forums/topic/expiration-for-posts/#post-956514 but Dashboard not grab it (shows 3 days as last post???).

#956557

To go back on topic. If I get you well, I can (should) systematically to use taxonomies in multiple occasions. Very practical example. I have list of 27 banks in Ecuador (description and logo is added). Initial reason was to use that list like 'compatible' credit cards issuers when business have optical card reader at establishment, for purpose to charge clients.

Now, as I need again list of same banks for purpose to display wire payments options (banks), you basically say that I should to create selectable field where I can one more time to use same taxonomies, for different purpose. If I'm not wrong, I should to be able than to have also 'filters' on archive pages to display businesses who can charge CC from 'Bank XXX', as well filter for display who accept wire transfers from (ie) 'Bank ZZZ'.

Did I get well your explanation?

#957263

Nigel
Supporter

Languages: Inglés (English ) Español (Español )

Timezone: Europe/London (GMT+01:00)

Ermm, I'm not sure we are still talking about the same thing as the opening question about marking certain taxonomy terms as featured.

Regarding accepting payment in cc from certain banks and accepting wire transfers from certain banks, which each business can set, and then being able to filter businesses by whether they accept cc's from a certain bank, or accept wire transfers from a certain bank...

Well. Recall that to be able to filter one thing by some property, that property needs to be a property of the thing you want to filter. (We don't yet support filtering by fields of related posts, we only support filtering by own fields, including taxonomies.)

If you are using a taxonomy for banks, you can't somehow edit a business post and have the term for one bank serve two purposes, to indicate that cc's are accepted from that bank, and/or that wire transfers are accepted from that bank.

You would need two taxonomies. One for "accepts bank cc" and another for "accepts bank transfer", even though the terms (banks) would basically be duplicated, they serve different purposes, that's just how they work.

However, maybe relationships can come to the rescue. You can create more than one relationship between the same post types.

You can create a bank post type, with 27 bank posts and fields for their logo etc.

You can then create one relationship between banks (parent) and businesses (child) for "accepts cc" and then create another relationship which is essentially the same but for "accepts transfers".

Then on an individual post you can separately assign banks for "accepts cc" and/or "accepts transfer", without the duplication required if using taxonomies.

#957393

Ermm, I'm not sure we are still talking about the same thing as the opening question about marking certain taxonomy terms as featured.

I thought that is the same, but you in answer made it clear. Thanks.

#957475

Sorry for reopening. I tried and I figured that I'm not clear with way how to 'extract' featured taxonomies, as I'm confused with couple of thinks.

1) To be capable at all to get available taxonomies, it is obvious how user first must to save post with checked taxonomies (except is some sort of dynamic population is not available), right?

2) Than I obviously also need to use checkboxes as custom field (to a void RF), but it should to be limited (ie to 10 taxonomies check).

3) If above is correct (that there is some sort of dynamic population), I don't have any idea how to do it. From other side, if there is not some kind of 'dynamic population', I don't think how this is useful and applicable for this purpose.

4) As far I saw in support topics, there is also very likely issue with possible search filtration of such 'extracted featured taxonomies' (or all that is already fixed by updates?).

5) Finally, solution 'smell' on serious usage of too many queries (read - 'resources leakage'), right?

#1069264

Nigel
Supporter

Languages: Inglés (English ) Español (Español )

Timezone: Europe/London (GMT+01:00)

Hi Ljuba

Sorry, I don't really understand the last update.

Are we back to talking about the original issue of featured taxonomies?

The UI for taxonomies is generated automatically, you can't readily influence which terms are included and which not.

You can dynamically update Types select fields (when generated on the backend or in CRED forms, or when used as Views filter controls, including if displayed as checkboxes) using the wpt_field_options filter described previously.

Regarding your last point, your business/accommodation pages already run a lot of queries, the more you add the more server resources you will need to be able to handle efficiently.

#1069589

==> "Are we back to talking about the original issue of featured taxonomies?"
Yes.

==> "wpt_field_options filter"
I saw in support pages and I think that I know how it works. However, I will quit from feature.

Issue have 3 different problems (too much) and better is to see what to do with redesign options than to force this.

Thanks for effort. In any case your support was as I expected.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.