Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 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.
    Thread Starter baggadap

    (@baggadap)

    Dear Jim

    Thank you so much!
    In the meantime, a workaround would be to use the “action_links”-array and link to the default add/edit post.php page.
    But how do I get the post ID within the array to build the “edit” link?

    'action_links' => array( 
     //Override the array that builds the edit link, you may supply a string with the name of a helper to get the array from - or give the array itself
     'add'      => 'post-new.php?post_type=koncert',
     'edit'      => 'post.php?post='.$function_to_get_id().'&action=edit',
     ),
    
    Thread Starter baggadap

    (@baggadap)

    Jim, Thank you so much for the quick answer!
    I have the Featured Image in the ‘manage’ array already, I need it when I’m going to the “add” or “edit” screens. Here is my code:

    $object = pods('koncert');
    $fields = array();
    
    //iterate through registered fields
    foreach($object->fields as $field => $data) {
    	$fields[$field] = array('label' => $data['label']);
    }
    
    $edit_fields = $fields;
      
    
    //fields visible on manage screens
    $manage_fields = array(
        	'name', 
        	'post_thumbnail.100x100' => 'Foto',
        	'koncerter_start_date', 
       
    );
    
    $object->ui = array(
        	'wp-css' => 1,
            'item'   => 'book',
            'items'  => 'books',
            'fields' => array(
                'add'       => $fields,
                'edit'      => $edit_fields,
                'duplicate' => $fields,
                'manage'    => $manage_fields,
            ),
           'actions_bulk' => array(
                //adds built in delete function
                'delete' => array(
                'label' => 'Delete',
                ),
            ),
        );
    pods_ui($object);
Viewing 3 replies - 1 through 3 (of 3 total)