Skip to content

Instantly share code, notes, and snippets.

@LaxusCroco
Created May 21, 2025 07:57
Show Gist options
  • Select an option

  • Save LaxusCroco/575fb4736aebef65b322bc671e6ba62c to your computer and use it in GitHub Desktop.

Select an option

Save LaxusCroco/575fb4736aebef65b322bc671e6ba62c to your computer and use it in GitHub Desktop.

Revisions

  1. LaxusCroco created this gist May 21, 2025.
    24 changes: 24 additions & 0 deletions show_units_count_ac.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,24 @@
    <?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;

    } );