Skip to content

Instantly share code, notes, and snippets.

@MjHead
Created January 17, 2024 16:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MjHead/59687327a0e1de21521a117dbc723932 to your computer and use it in GitHub Desktop.
Save MjHead/59687327a0e1de21521a117dbc723932 to your computer and use it in GitHub Desktop.
JetBooking. Add one more CPT as booking instance
<?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