• Resolved Vovi

    (@rossdav)


    I am experimenting with adding custom form elements via code (not the plugin) using the sample code you provide.

    The custom field is displayed but it introduces a problem where the Step one enabled / disabled is no longer honoured and constantly displays.

    If I disable your snippet it goes back to correctly disabling the Step one panel.

    Any ideas why?

    • This topic was modified 4 years, 5 months ago by Vovi.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Contributor Ben Meredith

    (@benmeredithgmailcom)

    Hi @rossdav,

    Very glad you reached out, here!

    Are you referring to this snippet?

    We’re happy to run some tests to see if there is a workaround, but I just want to make sure we’re talking about the same snippet.

    Thanks!

    Thread Starter Vovi

    (@rossdav)

    Hi, a modified version of that snippet, yes. I just tried an unchanged version of your exact snippet and it works ?? – which makes no sense to me.

    I’m basically trying to populate a dropdown from 2 CPTs. Its works a treat but just has this strange knock on effect.

    My main function code is:

    /*
     * Add Custom Donation Form Fields
     *
     * @param $form_id
     */
    function give_win_custom_form_fields( $form_id ) {
    	// Only display for forms with the IDs "754" and "578";
    	// Remove "If" statement to display on all forms
    	// For a single form, use this instead:
    
    	
    // One-off Donation Form	
    	
    	if ( $form_id == 211294) {
    //	$forms = array( 211294 ); 
    //if ( in_array( $form_id, $forms ) ) { ?>
    
     <div id="gift_location-wrap" class="form-row form-row-full">
    			<label class="give-label" for="gift_location">
    				Where would you like the gift to be used? <span class="give-required-indicator">*</span>
    			</label>
    		
    		<select id="gift_location" name="gift_location" data-required="yes" data-type="select" required="required" tabindex="-1">
    		<option value="wherever it will help the most" selected="selected">wherever it will help the most</option>
    
    			<?php 
        			query_posts(array( 
            		'post_type' => 'countries',
            	 	 'posts_per_page' =>-1,
    				 'meta_query' => array(
            			array(
                			'key'     => 'donation_availability',
                			'value'   => '"One-off"',
                			'compare' => 'LIKE'
            				))	
        			) );  
    				
    			 while (have_posts()) : the_post(); ?>
            	  <option value="<?php the_title(); ?>"><?php the_title(); ?></option>
    			<?php endwhile;?>
    
    			<?php 
        			query_posts(array( 
            		'post_type' => 'appeal',
            	 	 'posts_per_page' =>-1,
        			) );  
    				
    			while (have_posts()) : the_post(); ?>
            	  <option value="<?php the_title(); ?>"><?php the_title(); ?></option>
    			<?php endwhile;?>
    			</select>
    		</div>
    	<?php
    	// endif;
     }
    	
    }	
    add_action( 'give_after_donation_levels', 'give_win_custom_form_fields', 10, 1 );
    Thread Starter Vovi

    (@rossdav)

    To add… I’m happy to purchase the Form manager, but it doesn’t look like it supports what I want to achieve, just fixed options not dynamic.

    Thread Starter Vovi

    (@rossdav)

    As a follow up to anyone that maybe finds themselves in a similar situation, the issue was I was using query_posts(). When I rewrote the code to use wp_query() instead it worked as intended and no more unrequired step one page

    ??

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Disabled Step One Still showing’ is closed to new replies.