Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // this code goes in your theme's functions.php file
- // http://www.gravityhelp.com/forums/topic/display-the-calendar-in-the-opened-state#post-150402
- // only enqueue the script when form 328 is being embedded
- // change 328 here to your form's ID
- add_action('gform_enqueue_scripts_328', 'enqueue_open_datepicker', 10, 2);
- function enqueue_open_datepicker($form, $is_ajax) {
- // enqueue the script to open the datepicker. Script is stored in the child theme /js/ subdirectory,
- // and depends on jQuery and the jQuery UI Datepicker script
- wp_enqueue_script('open_datepicker', get_stylesheet_directory_uri() . '/js/datepicker-open.js', array('jquery','jquery-ui-datepicker'));
- }
- // this code goes in to a file called datepicker-open.js in a folder inside your theme folder, called js
- // this will force all datepicker open on load. You can use different selectors here if you want to
- // instead of .gform_wrapper and input
- jQuery(document).ready(function($) {
- $( "body .gform_wrapper input.datepicker" ).datepicker( "show" );
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement