Created
May 21, 2025 07:57
-
-
Save LaxusCroco/575fb4736aebef65b322bc671e6ba62c to your computer and use it in GitHub Desktop.
Adds the Show units count admin callback in CPT
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 | |
function show_units_count_ac( $column, $post_id ) { | |
if ( ! is_plugin_active( 'jet-booking/jet-booking.php' ) ) { | |
return ''; | |
} | |
$units = jet_abaf()->db->get_apartment_units( $post_id ); | |
$units_count = ! empty( $units ) ? count( $units ) : 0; | |
return $units_count; | |
} | |
add_filter( 'jet-engine/post-type/predifined-columns-cb-for-js', function( $column_callbacks ) { | |
$column_callbacks[ 'show_units_count_ac' ] = array( | |
'description' => __( 'Show units count', 'jet-engine' ), | |
); | |
return $column_callbacks; | |
} ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment