You can get the specific field information by doing this [wp_get_field id='[wpv-post-id]' field='wpcf-my-field']
This support ticket is created Il y a 6 années et 1 mois. 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.
Aucun de nos assistants n'est disponible aujourd'hui sur le forum Jeu d'outils. Veuillez créer un ticket, et nous nous le traiterons dès notre prochaine connexion. Merci de votre compréhension.
The issue is not resolved yet and I am looking for other ways to find a solution.
It is all about checking if the field has a value, if it does print it to the page, if not don't.
First I was thinking to leave out the condition altogether and that indeed solves the problem because if the field is empty and is printed to the layout it doesn't leave an error, but...
in most cases within those conditions I start with a heading for that field:
<h3>References</h4>
--- here the references field content ---
So now if the field is empty there still is this heading... (thats why I use the condition)
Now I am thinking to turn the condition into a class like this:
$references = "showme";
if ($(wpcf-references) eq '' ){$references="hideme";}
then for the html I could wrap the section in a div and add the class to it like this:
To get a better understanding of this, its that you want to perform your conditionals within a shortcode and then print out that value using the custom shortcode ?
Yes, I think if I can avoid the conditions then the page will load normaly.
At the moment all shortcodes within conditions are not executed on pages with a lot of images. I need a workarround.
So I want to turn the conditions of all those fields into a css class that I can add to the appropiate divs as explained above.
I do not neccesairily want to use short codes, but I need a way to check those fields.
If you have a better solution let me know.
Well it's not that I don't know how to create a shortcode Shane.
I need help how to get those values that are now conditions into my layout.
Maybe it can be done with shortcodes but if so I need help how to get those field values.
But then again, maybe there is a better way. Did you read and understand my first post?
So essentially what you want to do is to check in the code if the fields are empty and if they are not return a class that you can use to hide the entire div right ?
The figures&tables field (field type image), and the video field (field type embedded media) are not recognized as empty when empty.
Do you know a way to check those aswell?
I noticed that you are not using the wpcf- prefix on the field attribute. Since this is a custom shortcode, when retrieving or checking types fields you need to use the wpcf- prefix on the field names.
Example "wpcf-ddid"
Hi Shane,
I saw that the ddid field was the only one where this prefix was missing. Did you see that?
On this example page two field should be hidden.
Did you see the page not correctly returning when empty on the "wpcf-tables-figures" field and "wpcf-video-media"?