| 1 |
<?php |
| 2 |
/** |
| 3 |
* Standalone listing card — v2 (horizontal split: photo left, details right). |
| 4 |
* Theme-overridable: copy to your theme's mlsimport/card-v2.php. Receives: |
| 5 |
* $post WP_Post The listing post. |
| 6 |
* $row object|null The mlsimport_listings row (searchable scalars). |
| 7 |
* |
| 8 |
* Same data + action slots as v1 (mlsimport_card_view); a different layout. |
| 9 |
* |
| 10 |
* @package Mlsimport |
| 11 |
*/ |
| 12 |
|
| 13 |
if ( ! defined( 'ABSPATH' ) ) { |
| 14 |
exit; |
| 15 |
} |
| 16 |
|
| 17 |
// Build the flattened card view model (same shape as v1); only the layout differs here. |
| 18 |
$mli = mlsimport_card_view( $post, $row ); |
| 19 |
?> |
| 20 |
<article class="mlsimport-listing-card mlsimport-listing-card--v2" data-id="<?php echo esc_attr( (string) $mli['id'] ); ?>"> |
| 21 |
<?php |
| 22 |
// Extension slot: fires before the card link. |
| 23 |
do_action( 'mlsimport_card_before', $post, $row ); ?> |
| 24 |
<a class="mlsimport-listing-card__link" href="<?php echo esc_url( $mli['permalink'] ); ?>"> |
| 25 |
<?php |
| 26 |
// Photo-left half of the split: renders only when a thumbnail is available. |
| 27 |
if ( $mli['has_thumb'] ) : ?> |
| 28 |
<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'] ); ?>')"> |
| 29 |
<?php |
| 30 |
// Status badge overlaid on the media, only when set. |
| 31 |
if ( '' !== $mli['status'] ) : ?> |
| 32 |
<span class="mlsimport-listing-card__badge"><?php echo esc_html( $mli['status'] ); ?></span> |
| 33 |
<?php endif; ?> |
| 34 |
</div> |
| 35 |
<?php endif; ?> |
| 36 |
<div class="mlsimport-listing-card__body"> |
| 37 |
<?php |
| 38 |
// Extension slot: top of the card body. |
| 39 |
do_action( 'mlsimport_card_body_start', $post, $row ); ?> |
| 40 |
<?php |
| 41 |
// Price leads the v2 body, only when a formatted price exists. |
| 42 |
if ( '' !== $mli['price_fmt'] ) : ?> |
| 43 |
<span class="mlsimport-listing-card__price"><?php echo esc_html( $mli['price_fmt'] ); ?></span> |
| 44 |
<?php endif; ?> |
| 45 |
<h3 class="mlsimport-listing-card__title"><?php echo esc_html( $mli['address'] ); ?></h3> |
| 46 |
<?php |
| 47 |
// Specs line (beds/baths/area etc.), space-dot joined, only when present. |
| 48 |
if ( ! empty( $mli['specs'] ) ) : ?> |
| 49 |
<p class="mlsimport-listing-card__specs"><?php echo esc_html( implode( ' · ', $mli['specs'] ) ); ?></p> |
| 50 |
<?php endif; ?> |
| 51 |
<?php |
| 52 |
// Agency row (office name only in v2), only when the office is set. |
| 53 |
if ( '' !== $mli['office'] ) : ?> |
| 54 |
<div class="mlsimport-listing-card__agency"><span class="mlsimport-listing-card__office"><?php echo esc_html( $mli['office'] ); ?></span></div> |
| 55 |
<?php endif; ?> |
| 56 |
<?php |
| 57 |
// Extension slot: bottom of the card body. |
| 58 |
do_action( 'mlsimport_card_body_end', $post, $row ); ?> |
| 59 |
</div> |
| 60 |
</a> |
| 61 |
<?php |
| 62 |
// Extension slot: after the media/link (outside the anchor). |
| 63 |
do_action( 'mlsimport_card_after_media', $post, $row ); ?> |
| 64 |
<?php |
| 65 |
// Extension slot: after the whole card. |
| 66 |
do_action( 'mlsimport_card_after', $post, $row ); ?> |
| 67 |
</article> |
| 68 |
|