I have a custom post type accommodation (hbook plugin)
I have a toolset template for that custom post type
I have a custom field set of checkboxes displayed in the custom post type which lists room amenities.
I would like each one that is checked to cause an icon to display on the front end
I can not just put the icons in the template as rooms feature some amenities and not others
For example my client checks Air con, Safe, Shower. The 3 icons for those things appear on the front end and not those for the unchecked items.
Can I do this? Is my approach wrong?
Is there any documentation to explain?
Yes I have created a multiple checkbox custom field with toolset and it appears in the custom post type accommodation.
Accommodation post type has a toolset template assigned.
Not sure if this is even the right approach.
I just want a way for the user to say that selected svg icons should appear for a particular accommodation post.
Hi,
I am looking into that. But let's just forget all about the checkboxes for a while.
I am using Kadence pro theme and blocks and toolset.
If I have accommodation post type.
A toolset template for that post type built with blocks.
I can not put the svg icons in the template because each accommodation post needs to show only a subset of the icons on the front end.
Somehow I must be able to have the post type communicate to the template what icons to show.
What would be the best way?
The svg icons are displayed by a block.
Could I have the icons in the custom post type and pull them into the template?
Just looking for the right way to do this.
Hi,
I am not currently uploading the svg files to my media library. If that is possible I would be willing to if it would help.
Currently I use "The Icon Block" which allows me to paste the actual svg code into the block, then has some simple styling controls.
I use it this way on basic pages. I am not sure it can be used for my problem in a template. https://wordpress.org/plugins/icon-block/
I am open to any solution that works.
The block does allow me to add a class like most gutenburg blocks in the advanced section. If that helps.
Is there a way I could set the blocks individually to display:none using toolset. I could have all of the icons in the template and turn some off?
Just trying to have some ideas!
So, what if you add a conditional block and setup the conditional statement using block. If you can able to share admin access details and share where you want to display what icon based on what checkbox option then I can review the setup and able to guide you in right direction.
*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.
I have set the next reply to private which means only you and I have access to it.
Hi,
I am on vacation so did not set up a page for you to try. I did try the conditional block.
I got it to work by making a custom field single check box for each item.
I could not get it to work with a multiple checkbox custom field Amenities. I tried setting the check boxes to return a unique static value such as 'bath' or 'tv' When I tried this it did not work although debug seemed to say my value was being returned.
I am fine as it is, but it would be neater to have 1 multiple checkbox custom field. Is there a way to make that work?
Yes - we do have way to check conditionals for both single checkbox field and multiple checkboxes field.
Once you get back from your vacation, please let me know and share the access details with test page and I'm happy to guide you in the right direction.
Das Thema „[Geschlossen] toolset template, custom field checkbox in custom post displays icon“ ist für neue Antworten geschlossen.