Problem:
Check if a field is empty using custom coding.
Solution:
This can be done by adding the following custom shortcode to your functions.php file.
// Add Shortcode function wp_check_field( $atts ) { // Attributes $atts = shortcode_atts( array( 'id' => '', 'field' => '', ), $atts ); $field = get_post_meta($atts['id'],$atts['field']); $class = ''; if(!empty($field[0])){ $class = ''; return; } return $class; } add_shortcode( 'wp_check_field', 'wp_check_field' );
You can get the specific field information by doing this [wp_get_field id='[wpv-post-id]' field='wpcf-my-field']
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.
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
---|---|---|---|---|---|---|
- | 9:00 – 12:00 | 9:00 – 12:00 | 9:00 – 12:00 | 9:00 – 12:00 | 9:00 – 12:00 | - |
- | 13:00 – 18:00 | 13:00 – 18:00 | 13:00 – 18:00 | 14:00 – 18:00 | 13:00 – 18:00 | - |
Supporter timezone: America/Jamaica (GMT-05:00)
Ce sujet contient 16 réponses, a 3 voix.
Dernière mise à jour par Il y a 6 années et 1 mois.
Assisté par: Shane.