• Resolved baggadap

    (@baggadap)


    Hi all

    I want to use the same datetime picker as in the Pods, in some custom code i have written.
    Can I kindly ask what script the Pods datetimepicker uses, and how do I engage it?

    Thanks in advance

    Mathias

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter baggadap

    (@baggadap)

    I looked in the PODS source and found out how it works. First load the proper scripts:

    /**
     * Load Timepicker add-on
     *
     * 
     *
     */	
    	
    	 if ( ! wp_script_is( 'jquery-ui-slideraccess', 'registered' ) ) {
    			// No need to add dependencies. All managed by jquery-ui-timepicker.
    			wp_register_script( 'jquery-ui-slideraccess', trailingslashit( plugin_dir_url( __DIR__ ) ) . 'pods/ui/js/timepicker/jquery-ui-sliderAccess.js', array(), '0.3' );
    		}
    		if ( ! wp_script_is( 'jquery-ui-timepicker', 'registered' ) ) {
    			wp_register_script(
    				'jquery-ui-timepicker', trailingslashit( plugin_dir_url( __DIR__ ) ) . 'pods/ui/js/timepicker/jquery-ui-timepicker-addon.min.js', array(
    					'jquery',
    					'jquery-ui-core',
    					'jquery-ui-datepicker',
    					'jquery-ui-slider',
    					'jquery-ui-slideraccess',
    				), '1.6.3'
    			);
    		}
    		if ( ! wp_style_is( 'jquery-ui-timepicker', 'registered' ) ) {
    			wp_register_style( 'jquery-ui-timepicker', trailingslashit( plugin_dir_url( __DIR__ ) ) . 'pods/ui/js/timepicker/jquery-ui-timepicker-addon.min.css', array(), '1.6.3' );
    		}
     
    	
    wp_enqueue_script('jquery-ui-timepicker');
    wp_enqueue_style( 'jquery-ui-custom', trailingslashit( plugin_dir_url( __DIR__ ) ) . 'pods/ui/css/smoothness/jquery-ui.custom.css' );
    wp_enqueue_style( 'jquery-ui-timepicker' );

    Then engage with ie
    $('#basic_example_1').datetimepicker();

    • This reply was modified 6 years, 5 months ago by baggadap.
    Plugin Contributor pglewis

    (@pglewis)

    This will work for now and is the info I was going to include for you before you did the legwork yourself.

    Be advised that Gutenberg has a react-based DateTime component and we will almost certainly be switching to that for 2.8. I need to dig up the GH issue they had for that new-ish component, last I looked several weeks back they had a lot of things to do still.

    www.ads-software.com/gutenberg/handbook/components/date-time/

    • This reply was modified 6 years, 5 months ago by pglewis.
    • This reply was modified 6 years, 5 months ago by pglewis.
    • This reply was modified 6 years, 5 months ago by pglewis.
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Datetime picker’ is closed to new replies.