ACF Pro: Upgrade from free, add Documents repeater field with download buttons

This commit is contained in:
Hanson.xyz Dev
2025-11-28 17:49:39 -06:00
parent be833efe62
commit 3c76e76068
641 changed files with 45247 additions and 14 deletions
@@ -33,6 +33,7 @@ while (have_posts()) :
$property_features = get_field('property_features', $property_id);
$gallery = get_field('property_gallery', $property_id);
$listing_agent = get_field('listing_agent', $property_id);
$property_documents = get_field('property_documents', $property_id);
// Get status from taxonomy
$status_terms = get_the_terms($property_id, 'property_status');
@@ -140,6 +141,33 @@ while (have_posts()) :
</section>
<?php endif; ?>
<!-- Documents -->
<?php if ($property_documents && is_array($property_documents)) : ?>
<section class="property-documents">
<ul class="documents-list">
<?php foreach ($property_documents as $doc) :
if (!$doc['file']) continue;
$file = $doc['file'];
$label = $doc['label'] ?: $file['filename'];
$ext = pathinfo($file['filename'], PATHINFO_EXTENSION);
?>
<li class="document-item">
<a href="<?php echo esc_url($file['url']); ?>" class="document-link btn btn-secondary" target="_blank" download>
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true">
<path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/>
<polyline points="14 2 14 8 20 8"/>
<line x1="12" y1="18" x2="12" y2="12"/>
<polyline points="9 15 12 18 15 15"/>
</svg>
<?php echo esc_html($label); ?>
<span class="document-ext">(<?php echo esc_html(strtoupper($ext)); ?>)</span>
</a>
</li>
<?php endforeach; ?>
</ul>
</section>
<?php endif; ?>
<!-- Description -->
<section class="property-description">
<h2 class="section-title">Description</h2>