Tell us what you are trying to do?
I would like add a conditionnal output in php template of yith popup quick view
hidden link
Is there any documentation that you are following?
no
Is there a similar example that we can see?
in toolset environement :
<!-- Picto caracteristique vin -->
[wpv-conditional if="( $(wpcf-vin-nature) eq '1' )"]<img src="hidden link" alt="Vin Nature" />[/wpv-conditional]
[wpv-conditional if="( $(wpcf-sans_sulfite) eq '1' )"]<img src="hidden link" alt="Vin sans sulfite" />[/wpv-conditional]
[wpv-conditional if="( $(wpcf-vin_bio) eq '1' )"]<img src="hidden link" alt="Vin BIO" />[/wpv-conditional]
[wpv-conditional if="( $(wpcf-agriculture-raisonnee) eq '1' )"]<img src="hidden link" alt="Vin issus de l'agriculture raisonnée" />[/wpv-conditional]
[wpv-conditional if="( $(wpcf-vin-en-biodynamie) eq '1' )"]<img src="hidden link" alt="Vin en Biodynamie" />[/wpv-conditional]
[wpv-conditional if="( $(wpcf-vin_vegan) eq '1' )"]<img src="hidden link" alt="Vin Vegan (ne contient pas de trace d'origine animale)" />[/wpv-conditional]
[wpv-conditional if="( $(wpcf-conversion-bio) eq '1' )"]<img src="hidden link" alt="Vin en conversion BIO" />[/wpv-conditional]
by php way :
hidden link
What is the link to your site?
hidden link
Hello, you can get the raw value of a custom field from the database using get_post_meta:
$value = get_post_meta( 123, 'wpcf-vin-nature', true );
Replace 123 with the numeric ID of a post, or if you have access to the global $post you can use $post->ID. Documentation for WordPress's get_post_meta is available here: https://developer.wordpress.org/reference/functions/get_post_meta/
To get the formatted value of a custom field, like a formatted date from a date field or a formatted HTML link from a URL field, you can use the Types field API types_render_field. We have documentation and examples for that API availble here: https://toolset.com/documentation/customizing-sites-using-php/functions/
A more complete example:
global $post;
$vin_nature = get_post_meta( $post->ID, 'wpcf-vin-nature', true );
if( int_val($vin_nature) == 1 ) {
echo "<img src="<em><u>hidden link</u></em>" alt="Vin Nature" />"
}
Let me know if you have questions about that.