Hello I need to understand how to set the categories with logical condition, I tried and I almost succeeded. I followed your video tutorial. But when I try to insert a post from the frontend, if I change the category, do not load the fields that I have customized.
To give you an example, I need that when I'm in the form to insert the post from the frontend, in the beginning you select the category and based on the selected category load the custom fields that I have set. In real time. Similar to how your demo filters work
You have a front-end form to publish a post, and the form includes a category selector. You want certain custom fields to be shown depending on what category is chosen.
I just noticed on that page the screenshot is out-of-date, there is no a separate button to insert the conditional group shortcodes (see my screenshot).
If you are following the documentation and have problems getting it to work, let me know.
hello thank you for the answer, the video was useful for me to understand how to solve.
If I can I want to ask you another couple of things. I'm building a general classifieds site, that is, it has all the categories to sell used items.
First of all I want to know if the taxonomy "category" I can make sure that there is not a pre-selected category when I start to insert a new post from the frontend, but I'd like to have the box written "- select -" and that it is mandatory then select a category
What I need to understand then is:
1. How do I enter the locations that can be selected from the post entry form?
2. Can I create locations based on multiple levels? eg region -> province -> city? And can I make sure they are on logical condition? that is, if I select a region, only the provinces of that selected region are loaded and the same thing for the cities after clicking the province
however I'm sorry, but I tried to follow the video, but it does not work with the categories.
In the video tells me how to use the logical condition between custom fields, but I need that the user first select the category and then load the custom fields under it selected.
I tried but it does not work.
In the field "value" you have to enter the id and in this case I put the id of the category and it does not work, I also tried to put the name of the category and it does not even work. Why?
Sorry, I had overlooked the fact that the UI currently does not allow you to insert taxonomies for the cred_show_group shortcode, and you need to insert them manually. (We do have an internal ticket to improve this, but it is not complete yet.)
If you are using standard WP categories (rather than a custom taxonomy) then you would enter something like the following:
[cred_show_group if="( $(category) eq 'value' )" mode="fade-slide"]
<p>Show this if condition passed</p>
[/cred_show_group]
The 'value' you need to test depends on whether you are displaying categories as a checkbox or a select dropdown. From your question it sounds like you are displaying it as a dropdown, in which case the value needs to be the category id (not the name, not the slug).
(If you were displaying as checkboxes, you would need to use the category slug.)
That's the main question. I'll follow up again with your other questions.
I don't know what your custom taxonomy is called, but you need to use the slug of the custom taxonomies in place of categories, so if your custom taxonomy had a slug of 'status' for example, you would need
[cred_show_group if="( $(status) eq 'value' )" mode="fade-slide"]
<p>Show this if condition passed</p>
[/cred_show_group]
where 'value' needs replacing with the ID of the taxonomy term you are testing for.
The easiest way to see the term ID is to go to the page that lists your terms, hover over the required term and the edit link (which you can see in the status bar at the bottom of the browser) will include tag_ID, which is the id you require for the value.
Ok I understood, but you still have not given me a complete solution. I'll give you some examples:
I create 3 categories
Cars
Properties
Work
I create generic custom fields
e-mail
telephone number
images
price
Then I need to customize the three categories with different custom fields for each one
For the cars category I want that in addition to the generic fields there are also:
Registration year
Kilometres
Color
For the property category I want for example the following custom fields:
Type of property
Size
Bedrooms
Bathrooms
Ok?
When I FROM FRONTEND i click on INSERT NEW POST there will be the form I created. And when I clicks on a category the extra fields of that category will be loaded.
So if they choose to publish a car, in addition to generic fields there will also be
Kilometres
Registration year
Color
But then if you think about it and change the category and select properties then the custom fields will also change and you will load those in the real estate category.
I hope I have been clear. I really appreciate your help but I think you still have not understood 100% what I'm interested in but it's quite simple, impossible that you can not do with toolset
You just need to include all of the fields that might be required on the form, and then wrap the parts that you only want to display when a particular category has been selected in a cred_show_group shortcode as I described in the last answer.
I can ask another thing?, as regards how to do to set that the "categories" module does not have to show the first category, but I would like it to be defaulted to nothing, with a writing like this "- select category -"