| 1 |
<?php |
| 2 |
/** |
| 3 |
* Standalone listing card โ v1 (default). Theme-overridable: copy to your theme's |
| 4 |
* mlsimport/card.php to restyle. Receives: |
| 5 |
* $post WP_Post The listing post. |
| 6 |
* $row object|null The mlsimport_listings row (searchable scalars). |
| 7 |
* |
| 8 |
* Compact, price-forward card. Data comes from mlsimport_card_view(); the card |
| 9 |
* action slots are the in-card extension points (see includes/standalone/listing-card.php). |
| 10 |
* |
| 11 |
* @package Mlsimport |
| 12 |
*/ |
| 13 |
|
| 14 |
if ( ! defined( 'ABSPATH' ) ) { |
| 15 |
exit; |
| 16 |
} |
| 17 |
|
| 18 |
// Build the flattened card view model (id, permalink, thumb, status, price_fmt, specs, office, logo, has_thumb). |
| 19 |
$mli = mlsimport_card_view( $post, $row ); |
| 20 |
?> |
| 21 |
<article class="mlsimport-listing-card mlsimport-listing-card--v1" data-id="<?php echo esc_attr( (string) $mli['id'] ); ?>"> |
| 22 |
<?php |
| 23 |
// Extension slot: fires before the card link. |
| 24 |
do_action( 'mlsimport_card_before', $post, $row ); ?> |
| 25 |
<a class="mlsimport-listing-card__link" href="<?php echo esc_url( $mli['permalink'] ); ?>"> |
| 26 |
<?php |
| 27 |
// Media block renders only when a thumbnail is available. |
| 28 |
if ( $mli['has_thumb'] ) : ?> |
| 29 |
<div class="mlsimport-listing-card__media" role="img" aria-label="<?php echo esc_attr( $mli['address'] ); ?>" style="background-image:url('<?php echo esc_url( $mli['thumb'] ); ?>')"> |
| 30 |
<?php |
| 31 |
// Status badge (e.g. Active/Sold) overlaid on the media, only when set. |
| 32 |
if ( '' !== $mli['status'] ) : ?> |
| 33 |
<span class="mlsimport-listing-card__badge"><?php echo esc_html( $mli['status'] ); ?></span> |
| 34 |
<?php endif; ?> |
| 35 |
</div> |
| 36 |
<?php endif; ?> |
| 37 |
<div class="mlsimport-listing-card__body"> |
| 38 |
<?php |
| 39 |
// Extension slot: top of the card body. |
| 40 |
do_action( 'mlsimport_card_body_start', $post, $row ); ?> |
| 41 |
<?php |
| 42 |
// Price first (v1 is price-forward), only when a formatted price exists. |
| 43 |
if ( '' !== $mli['price_fmt'] ) : ?> |
| 44 |
<span class="mlsimport-listing-card__price"><?php echo esc_html( $mli['price_fmt'] ); ?></span> |
| 45 |
<?php endif; ?> |
| 46 |
<h3 class="mlsimport-listing-card__title"><?php echo esc_html( $mli['address'] ); ?></h3> |
| 47 |
<?php |
| 48 |
// Specs line (beds/baths/area etc.), space-dot joined, only when present. |
| 49 |
if ( ! empty( $mli['specs'] ) ) : ?> |
| 50 |
<p class="mlsimport-listing-card__specs"><?php echo esc_html( implode( ' ยท ', $mli['specs'] ) ); ?></p> |
| 51 |
<?php endif; ?> |
| 52 |
<?php |
| 53 |
// Agency row shows when either the office name or the MLS logo is set. |
| 54 |
if ( '' !== $mli['office'] || '' !== $mli['logo'] ) : ?> |
| 55 |
<div class="mlsimport-listing-card__agency"> |
| 56 |
<span class="mlsimport-listing-card__office"><?php echo esc_html( $mli['office'] ); ?></span> |
| 57 |
<?php |
| 58 |
// MLS/source logo, only when set. |
| 59 |
if ( '' !== $mli['logo'] ) : ?> |
| 60 |
<img class="mlsimport-listing-card__mls" src="<?php echo esc_url( $mli['logo'] ); ?>" alt="<?php esc_attr_e( 'MLS', 'mlsimport' ); ?>" loading="lazy" /> |
| 61 |
<?php endif; ?> |
| 62 |
</div> |
| 63 |
<?php endif; ?> |
| 64 |
<?php |
| 65 |
// Extension slot: bottom of the card body. |
| 66 |
do_action( 'mlsimport_card_body_end', $post, $row ); ?> |
| 67 |
</div> |
| 68 |
</a> |
| 69 |
<?php |
| 70 |
// Extension slot: after the media/link (outside the anchor). |
| 71 |
do_action( 'mlsimport_card_after_media', $post, $row ); ?> |
| 72 |
<?php |
| 73 |
// Extension slot: after the whole card. |
| 74 |
do_action( 'mlsimport_card_after', $post, $row ); ?> |
| 75 |
</article> |
| 76 |
|