+7 (495) 778-74-86
Заказать звонок
Прием звонков по будням с 10:00 до 21:00
Перейдите в каталог, выберите требуемый товар и добавьте его в корзину.
add_shortcode( 'gf_conditional', 'gf_conditional_shortcode' ); function gf_conditional_shortcode( $atts, $content = null ) $atts = shortcode_atts( array( 'form_id' => 0, 'field_id' => 0, 'value' => '', 'operator' => '=' ), $atts ); if ( ! $atts['form_id'] [gf_conditional form_id="1" field_id="3" value="Option A"] You selected Option A! [/gf_conditional] 🧠 Real-World Examples Example 1: Show a special message after submission [gf_conditional form_id="5" field_id="2" value="Business"] Thanks! A business account manager will contact you. [/gf_conditional] Example 2: Show different content for different selections [gf_conditional form_id="5" field_id="4" value="Yes" operator="="] ✅ Great! We'll send you the guide. [/gf_conditional] [gf_conditional form_id="5" field_id="4" value="No" operator="="] ❌ No problem. You can still browse our resources. [/gf_conditional] 🔁 Alternative: Gravity Forms Merge Tags + Conditional Shortcode You can combine merge tags with conditional logic:
[gravityforms_conditional form_id="1" field_id="2" value="Yes"] This content shows only if field 2 = Yes. [/gravityforms_conditional] Some plugins support multiple operators: = , != , > , < , contains , etc. Add this to your theme’s functions.php file: gravity forms conditional shortcode