Allows to change initial set up of booking calendar. Usage example:
window.jetBookingState.filters.add( "jet-booking/input/config", ( config ) => {
const validateDay = config.beforeShowDay;
<?php | |
/** | |
* Instructions: | |
* | |
* 1. Create a filter for guests number - https://tppr.me/H7Sjzs, https://tppr.me/D5jImO | |
* 2. In the example below used 'max_guests' query variable for filter, you need replace it with your own. | |
* You need to do this under 'Replace this with your filter variable' comment | |
* 3. After this - each time when this filter applied - selected value will be stored, now you need to apply it in form | |
* 4. Set this value as default for Guessts field in the form - https://tppr.me/vwdRCV. | |
* 5. For the form keep the query var name from example - _booking_guests_num - here will be stored selected filter value |
{"post_title":"Apply to service","post_content":"<!-- wp:jet-forms\/hidden-field {\"name\":\"provider_id\"} \/-->\n\n<!-- wp:jet-forms\/select-field {\"field_options_from\":\"posts\",\"field_options_post_type\":\"services\",\"name\":\"service_id\"} \/-->\n\n<!-- wp:jet-forms\/submit-field \/-->","meta_input":{"_gspb_post_css":"","_jf_actions":"[{\"id\":3775,\"settings\":{\"send_email\":{\"subject\":\"New order on website\",\"content\":\"Hi admin!\\n\\nThere are new order on your website.\\n\\nOrder details:\\n- Post ID: %post_id%\"},\"call_hook\":{\"hook_name\":\"apply-to-service\"}},\"type\":\"call_hook\",\"conditions\":[],\"events\":[]}]"}} |
<?php | |
add_filter( 'jet-theme-core/location/render/template-id', function( $template_id ) { | |
/** | |
* 123 - is ID of initial template you set in ThemeCore (could be found in adress bar) | |
* 'alternate-value' - is value of option which enables alternative layout for this page | |
* page-slug and option-name - there are option page slug and option name itself which are responsible for layout | |
*/ | |
if ( 123 === $template_id && 'alternate-value' === jet_engine()->listings->data->get_option( 'page-slug::option-name' ) ) { |
<?php | |
add_filter( 'jet-form-builder/form-handler/form-data', function( $request ) { | |
if ( isset( $request['field_name_to_sanitize'] ) ) { | |
$request['field_name_to_sanitize'] = wp_strip_all_tags( $request['field_name_to_sanitize'] ); | |
} | |
return $request; | |
} ); |
<?php | |
/** | |
* Add this code without opening PHP tag into funcitons.php og your active theme or with any code snippets plugin | |
*/ | |
add_action( | |
'rest_api_init', | |
function() { | |
/** | |
* Here you can set taxonomies slugs you wnat to add to Rest API response |
<?php | |
/** | |
* Add this code without opening PHP tag into funcitons.php og your active theme or with any code snippets plugin | |
*/ | |
add_action( | |
'rest_api_init', | |
function() { | |
// Here you can specify post types slug where this field should be supported | |
$supported_post_types = array( |
<?php | |
add_filter( 'jet-engine/listings/allowed-callbacks', 'my_je_callback_register' ); | |
function my_je_callback_register( $callbacks ) { | |
$callbacks['my_je_get_link_callback'] = 'Get link by meta fields'; | |
return $callbacks; | |
} | |
function my_je_get_link_callback() { | |
$label_field = 'status'; // Replace `status` with your meta field where link label is stored |
<?php | |
add_action( 'wp_footer', function() { | |
echo '<script> | |
jQuery( document ).on( "jet-booking/init-field", ( $event, $field ) => { | |
var silent = false; | |
var format = $field.data( "format" ) || "YYYY-MM-DD"; | |
$field.bind( "datepicker-change", ( event, obj ) => { | |
silent = ! silent; | |
if ( silent ) { | |
$field.data( "dateRangePicker" ).setEnd( moment( obj.date1 ).add( 7, "d" ).format( "YYYY-MM-DD" ) ); |