Support

Account

Home Forums Front-end Issues Time Picker Args

Solved

Time Picker Args

  • seems that the args are not taken into account for the time picker :

    function acf_timepicker_input_admin_footer() {
    ?>
    <script type="text/javascript">
    acf.add_filter('time_picker_args', function( args, $field ){
    	
      if($field.attr('data-key') == 'field_584fd81669c59') { 
    	args.stepMinute = 15;	
    	// return
    	return args;
    			
    });
    </script>
    <?php
    		
    }
    add_action('acf/input/admin_footer', 'acf_timepicker_input_admin_footer');
    
    

    can someone check ?

  • Hi @marc-bovetgmail-com

    I’ve just tested your code, and it works correctly on my end. Could you please check if there are any JavaScript error messages on the page? Also, could you please share the JSON export field of your field group so I can check your setup?

    Thanks 🙂

  • This reply has been marked as private.
  • Hi @marc-bovetgmail-com

    Thanks for sharing the export file. I’ve just tested it, and it seems you forgot to close the if statement. Could you please try the following code instead?

    function acf_timepicker_input_admin_footer() {
    ?>
    <script type="text/javascript">
    acf.add_filter('time_picker_args', function( args, $field ){
    	
      if($field.attr('data-key') == 'field_584fd81669c59') { 
    	args.stepMinute = 15;	
    	// return
    	return args;
      } // you forgot this closing
    			
    });
    </script>
    <?php
    		
    }
    add_action('acf/input/admin_footer', 'acf_timepicker_input_admin_footer');

    I hope this helps 🙂

  • 🙂

    thank you James !

  • Thank you james for posting the code It’s really good.

  • This is a really perfect for a new blogger like me who doesn’t want their site to be messy with those spammers who don’t even read your post but they have the guts to comment in your site. Thanks again.
    Speaking of site, take a look at here: chokdeebacarrat

Viewing 7 posts - 1 through 7 (of 7 total)

The topic ‘Time Picker Args’ is closed to new replies.