Created
January 17, 2024 16:11
-
-
Save MjHead/59687327a0e1de21521a117dbc723932 to your computer and use it in GitHub Desktop.
JetBooking. Add one more CPT as booking instance
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Replace additional-props with your CPT slug | |
DEFINE( 'BOOKING_ADDITIONAL_CPT', 'additional-props' ); | |
add_filter( 'jet-booking/settings/get/apartment_post_type', function ( $post_type ) { | |
if ( is_admin() ) { | |
if ( ! empty( $_GET['post_type'] ) && BOOKING_ADDITIONAL_CPT === $_GET['post_type'] ) { | |
$post_type = BOOKING_ADDITIONAL_CPT; | |
} | |
if ( ! empty( $_GET['post'] ) && BOOKING_ADDITIONAL_CPT === get_post_type( $_GET['post'] ) ) { | |
$post_type = BOOKING_ADDITIONAL_CPT; | |
} | |
} | |
return $post_type; | |
} ); | |
add_filter( 'jet-booking/tools/post-type-args', function( $args ) { | |
$args['post_type'] = [ $args['post_type'], BOOKING_ADDITIONAL_CPT ]; | |
return $args; | |
} ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment