WordPress ACF conditional logic for taxonomy fields - wordpress

I currently have a custom taxonomy select field called "Location" and another custom taxonomy called "Company". What I would want to do is to hide/show the Company check-boxes based on the chosen Location in the select box. This is for the back-end.
The Person custom post type is associated with a Company and each Company is associated with a Location taxonomy. Advanced Custom Fields conditional logic does not extend to taxonomy fields and if anybody knows a way to go around this limitation that would be super awesome.

I am looking for taxonomy-related conditional logic as well and I found a post on the ACF support forums (http://support.advancedcustomfields.com/forums/topic/conditional-logic-using-taxonomy-field/) that shows many other people looking for this as well. However, there was no solution or answer in this post (most recent post asking for help being 6/7/16). Perhaps it will be solved in the future given the many requests, but no answers there at present.
Seems that the best option for now is to use jQuery on the backend.

Related

Connect one CPT to another CPT in a wp_query loop

I am looking for the most efficient way to create two separate custom post types called "venues" and "offers". The role of such would be to display on a website it in the following way:
VENUE_1
offer A
offer B
etc
VENUE_2
offer C
As you see, the venues will be quite static, once added photos and descriptions will remain the same. The most dynamic thing are offers. They will vary from each other. I know I can handle that through ACF repeater in a single CPT but I don't want to use this solution due to a few technical requirements.
Is there any way that Wordpress (or Wordpress +ACF) will allow to do that? From the flow pov it will look like that:
an editor adds venue, with descriptions, photos etc through venue CPT
along the time an editor adds specific offers through offers CPT, selecting via e.g. dropdown to which venue it is connected
I have never used relationship fields in ACF but afaik while selecting I need to do it fully manually and select very specific offer. And as said, I want to handle later on only offers, avoiding situation when constantly I need to add manually those via venue item.
You're probably over complicating things.
You should approach it from a taxonomy point of view, meaning,
venue as a taxonomy, offer as a custom post type.
You can use taxonomy-<my-taxonomy>.php to create a specific template for your custom taxonomy. eg: taxonomy-venue.php.
You will be able to access your venue through the following permalink example.com/venue/my-awsome-venue
On each venue taxonomy pages you will a custom query to loop through each offer which are listed under the currently queried venue.
You should read Template Hierarchy from the codex, to have a better understanding of templating.

ACF group content in Elementor?

Elementor is great to link single ACF-field content.
But I need to combine some of them in the ACF Layout "group", so that it's easier for the customer to overview and edit the content.
But Elementor does not support ACF fields inside an ACF group – they simply don't show up in the Key-dropdown.
Is there a way to get that going?
According to document Elementor Integration With ACF on Elementor official website, complex custom field types such as group, repeater haven't been supported yet.
But there is a way to get value from ACF group field, see here(wordpress support thread). While I haven't tested it.
I know you may want to sort those fileds by categories or other taxonomies to get a better logic and cleaner interface. But this would also limit you to certain widget in 3rd party plugins. Built-in dynamic content is really handy, I don't think it's worthy to give it up by using ACF group field.
So I suggest you to use regular field types along with conditional logic(each of), it's a better choice at this moment though the interface would be messy.

How can I add custom fields for only top level taxonomy in WordPress?

I created a custom taxonomy. There are only 5 top level categories but tons of subcategories. Is it possible to add editable custom fields for only top level categories via Advanced Custom Fields or custom code solution?
Thanks!
This is a request that has been made many times before, but sadly never implemented by Elliot.
But you can create custom location rules, which other people have made before - If you want to create a parent level rule for acf, you could consider implementing this from github.
I know that other people has used it before.
Check the github out -> Here
Hopefully it will be implemented in the future, but for now it is not possible without creating your own rules.
Hope that it works for you.

WordPress Custom Post Logic

I'm a newbie here, but I've been trying to understand and research this for the past couple of days to no avail.
I created a custom post type (video) with a taxonomy associated with it (industries). The taxonomy "industries" has multiple categories (I'm not sure if in this case they are called terms rather than categories; correct me if I'm wrong!) such as IT, Construction, etc. For arguments sake, let's say under the category IT there is a single post named Web Developer.
First question: With the logic above, how would I manage to reach the single post (web developer) with the URL: .../video/IT/web developer?
Second question: If on the video page I would like to display all posts in all categories, what template page should I create? Is it archive-video.php? The same question goes for the category (IT in this case): Which template page should I create in order to display all posts under a specific category?
I'll answer your second question first:
Yes, the template you should use for displaying all the custom post types would be the CPT archive, so archive-video.php sounds right.
For the categories (the exact way to say it would be "taxonomy terms" indeed), you would use taxonomy-{taxonomy}.php or even taxonomy-{taxonomy}-{term}.php if you need to get more specific.
About your first question, there is currently no core functionality to use custom taxonomies in your permalinks, but this might help you.

Wordpress: custom post types: using custom fields or taxonomies?

I'm thinking about using WP custom post types to create a basic real estate website.
The post type will be for property listings. I've decided to have one post type for For Sale and one for Rentals, simple because they have somewhat different property information.
A typical listing will need to specify some information, ie, is it a house, an apartment or maybe it's just a piece of land.
What are the pros and cons of specifying this info using custom fields (meta data) versus using taxonomy (categories and tags)?
I can see that it's easy to search based on taxonomy, but custom post types meta data can also be queried.
Also, it seems that this question applies to any post data where discrete choices are required: meta data checkbox, select or taxonomy.
Any thoughts?
Thanks.
My preference for what you're trying to do would be taxonomy for the following reasons:
SEO and User Friendly URLs
With categories and tags, WordPress permalinks are setup to put that information in the URL for you. This will go a long way towards the SEO and usability of your site because you'll be able to create URLs like:
http://yoursite.com/rentals
http://yoursite.com/for-sale/two-bedroom/123-fake-street
Hierarchy
I don't know if you have the need for it, but building a hierarchy with categories is easy. This will give you lots of flexibility when it comes to organizing your posts.
Theme Coding
As you said, it's possible to perform custom queries for meta data, but WordPress has many out-of-the-box functions to query and display based on tags and categories. This will mean that you'll have to write less code to get your theme to do what you want.
I've done exactly what you are talking about, both ways (using Custom Fields versus Categories). My view is you should use a mix - use Categories for the most important information (eg For Sale, Type of Property etc) and use Custom Fields for the actual data for the listing.
Wordpress then has many built in functions to organise that data in a really intuitive way, and allows you to easily group properties of the same type together, in exactly the way a user wants to browse the data.

Resources