Opal-Estate-Pro/templates/single-property/attachments.php

35 lines
1.8 KiB
PHP
Raw Normal View History

2019-09-10 06:27:33 +02:00
<?php
global $property;
2019-10-03 05:13:19 +02:00
if ( 'on' !== $property->get_block_setting( 'attachments' ) ) {
2019-09-10 06:27:33 +02:00
return;
}
$attachments = $property->get_attachments();
?>
<?php if ( $attachments ) : ?>
<div class="property-attachments box-inner-summary">
<h5 class="list-group-item-heading"><?php esc_html_e( 'Attachments', 'opalestate-pro' ); ?></h5>
<div class="list-group-item-text">
<div class="<?php echo apply_filters( 'opalestate_row_container_class', 'opal-row' ); ?>">
2020-08-03 04:04:25 +02:00
<?php if ( is_array( $attachments ) ) : ?>
<?php foreach ( $attachments as $id => $attachment ) : ?>
<div class="col-lg-4 col-sm-4">
<i class="text-secondary fa fa-file-text-o"></i>
<a class="property-attachments__name" href="<?php echo esc_url( $attachment ); ?>"><?php echo esc_html( get_the_title( $id ) ); ?></a>
<a class="property-attachments__download" href="<?php echo esc_url( $attachment ); ?>" download><?php esc_html_e( 'Download', 'opalestate-pro' ); ?></a>
</div>
<?php endforeach; ?>
<?php else : ?>
<?php $attachment_id = absint( $attachments ); ?>
2019-09-10 06:27:33 +02:00
<div class="col-lg-4 col-sm-4">
<i class="text-secondary fa fa-file-text-o"></i>
2020-08-03 04:04:25 +02:00
<a class="property-attachments__name" href="<?php echo esc_url( get_permalink( $attachment_id ) ); ?>"><?php echo esc_html( get_the_title( $attachment_id ) ); ?></a>
<a class="property-attachments__download" href="<?php echo esc_url( get_permalink( $attachment_id ) ); ?>" download><?php esc_html_e( 'Download', 'opalestate-pro' ); ?></a>
2019-09-10 06:27:33 +02:00
</div>
2020-08-03 04:04:25 +02:00
<?php endif; ?>
2019-09-10 06:27:33 +02:00
</div>
</div>
</div>
<?php endif; ?>