Support

Account

Home Forums Front-end Issues Time Picker Args

Solved

Time Picker Args

    • mbo

    • December 13, 2016 at 10:46 pm

    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 ?

    • James

    • December 14, 2016 at 5:04 pm

    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 🙂

    • mbo

    • December 14, 2016 at 5:24 pm
    This reply has been marked as private.
    • James

    • December 15, 2016 at 11:48 am

    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 🙂

    • mbo

    • December 15, 2016 at 7:34 pm

    🙂

    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)

You must be logged in to reply to this topic.

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.