| 1 |
<?php |
| 2 |
/** |
| 3 |
* The template for displaying a single property within search results loops. |
| 4 |
* |
| 5 |
* Override this template by copying it to yourtheme/propertyhive/content-property.php |
| 6 |
* |
| 7 |
* @author PropertyHive |
| 8 |
* @package PropertyHive/Templates |
| 9 |
* @version 1.0.0 |
| 10 |
*/ |
| 11 |
|
| 12 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly |
| 13 |
|
| 14 |
global $property, $propertyhive_loop; |
| 15 |
|
| 16 |
// Store loop count we're currently on |
| 17 |
if ( empty( $propertyhive_loop['loop'] ) ) |
| 18 |
$propertyhive_loop['loop'] = 0; |
| 19 |
|
| 20 |
// Store column count for displaying the grid |
| 21 |
if ( empty( $propertyhive_loop['columns'] ) ) |
| 22 |
// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Existing public Property Hive extension hook loop_search_results_columns; changing the established name would detach installed callbacks. |
| 23 |
$propertyhive_loop['columns'] = apply_filters( 'loop_search_results_columns', 1 ); |
| 24 |
|
| 25 |
// Ensure visibility |
| 26 |
if ( ! $property ) |
| 27 |
return; |
| 28 |
|
| 29 |
// Increase loop count |
| 30 |
++$propertyhive_loop['loop']; |
| 31 |
|
| 32 |
// Extra post classes |
| 33 |
// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Template-local variable; the template is included through a helper/function scope, so PrefixAllGlobals misclassifies the file when checked standalone. |
| 34 |
$classes = array('clear'); |
| 35 |
if ( 0 == ( $propertyhive_loop['loop'] - 1 ) % $propertyhive_loop['columns'] || 1 == $propertyhive_loop['columns'] ) |
| 36 |
// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Template-local variable; the template is included through a helper/function scope, so PrefixAllGlobals misclassifies the file when checked standalone. |
| 37 |
$classes[] = 'first'; |
| 38 |
if ( 0 == $propertyhive_loop['loop'] % $propertyhive_loop['columns'] ) |
| 39 |
// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Template-local variable; the template is included through a helper/function scope, so PrefixAllGlobals misclassifies the file when checked standalone. |
| 40 |
$classes[] = 'last'; |
| 41 |
if ( $property->featured == 'yes' ) |
| 42 |
// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Template-local variable; the template is included through a helper/function scope, so PrefixAllGlobals misclassifies the file when checked standalone. |
| 43 |
$classes[] = 'featured'; |
| 44 |
?> |
| 45 |
<li <?php post_class( $classes ); ?>> |
| 46 |
|
| 47 |
<?php do_action( 'propertyhive_before_search_results_loop_item' ); ?> |
| 48 |
|
| 49 |
<div class="thumbnail"> |
| 50 |
<a href="<?php the_permalink(); ?>"> |
| 51 |
<?php |
| 52 |
/** |
| 53 |
* propertyhive_before_search_results_loop_item_title hook |
| 54 |
* |
| 55 |
* @hooked propertyhive_template_loop_property_thumbnail - 10 |
| 56 |
*/ |
| 57 |
do_action( 'propertyhive_before_search_results_loop_item_title' ); |
| 58 |
?> |
| 59 |
</a> |
| 60 |
</div> |
| 61 |
|
| 62 |
<div class="details"> |
| 63 |
|
| 64 |
<h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3> |
| 65 |
|
| 66 |
<?php |
| 67 |
/** |
| 68 |
* propertyhive_after_search_results_loop_item_title hook |
| 69 |
* |
| 70 |
* @hooked propertyhive_template_loop_floor_area - 5 (commercial only) |
| 71 |
* @hooked propertyhive_template_loop_price - 10 |
| 72 |
* @hooked propertyhive_template_loop_summary - 20 |
| 73 |
* @hooked propertyhive_template_loop_actions - 30 |
| 74 |
*/ |
| 75 |
do_action( 'propertyhive_after_search_results_loop_item_title' ); |
| 76 |
?> |
| 77 |
|
| 78 |
</div> |
| 79 |
|
| 80 |
<?php do_action( 'propertyhive_after_search_results_loop_item' ); ?> |
| 81 |
|
| 82 |
</li> |