Skip to content

Instantly share code, notes, and snippets.

@LaxusCroco
Created May 21, 2025 07:57
Show Gist options
  • Save LaxusCroco/575fb4736aebef65b322bc671e6ba62c to your computer and use it in GitHub Desktop.
Save LaxusCroco/575fb4736aebef65b322bc671e6ba62c to your computer and use it in GitHub Desktop.
Adds the Show units count admin callback in CPT
<?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