Commit f0d16cf3 by rajshah

handle format type and its images in resources listing

parent b81a6c18
...@@ -65,11 +65,12 @@ if (isset($resources_listing) && is_array($resources_listing) && !empty($resourc ...@@ -65,11 +65,12 @@ if (isset($resources_listing) && is_array($resources_listing) && !empty($resourc
</div> </div>
<div class="resource-content"> <div class="resource-content">
<div class="rc-detail"> <div class="rc-detail">
<h6><a href="<?php echo esc_url($post_url); ?>"> <h6><a href="<?php echo esc_url($post_url); ?>">
<?php echo esc_html($post_title); ?></a></h6> <?php echo esc_html($post_title); ?></a></h6>
<P class="sm-text"> <P class="sm-text">
<?php echo wp_trim_words($post_excerpt, 8, '...') ?: wp_trim_words($post_content, 8, '...'); ?> <?php echo wp_trim_words($post_excerpt, 8, '...') ?: wp_trim_words($post_content, 8, '...'); ?>
</P></div> </P>
</div>
<div class="format-and-btn-wrapper d-flex justify-content-between"> <div class="format-and-btn-wrapper d-flex justify-content-between">
<?php <?php
$downloadable_resource = get_field('downloadable_resource', $post_id) ?: []; $downloadable_resource = get_field('downloadable_resource', $post_id) ?: [];
...@@ -81,28 +82,28 @@ if (isset($resources_listing) && is_array($resources_listing) && !empty($resourc ...@@ -81,28 +82,28 @@ if (isset($resources_listing) && is_array($resources_listing) && !empty($resourc
$subtype = $upload_downloadable_resource['subtype']; $subtype = $upload_downloadable_resource['subtype'];
switch (strtolower($subtype)) { switch (strtolower($subtype)) {
case 'pdf': case 'pdf':
$icon_url = '/assets/img/pdf-icon.png'; $icon_url = get_field('pdf_image', 'option');
break; break;
case 'doc': case 'doc':
case 'docx': case 'docx':
$icon_url = '/assets/img/word-icon.png'; $icon_url = get_field('doc_image', 'option');
break; break;
case 'xls': case 'xls':
case 'xlsx': case 'xlsx':
$icon_url = '/assets/img/excel-icon.png'; $icon_url = get_field('xls_image', 'option');
break; break;
case 'ppt': case 'ppt':
case 'pptx': case 'pptx':
$icon_url = '/assets/img/ppt-icon.png'; $icon_url = get_field('ppt_image', 'option');
break; break;
default: default:
$icon_url = '/assets/img/pdf-icon.png'; $icon_url = get_field('default_image', 'option');
} }
endif; endif;
endif; endif;
?> ?>
<p class="sm-text">Format: <img <p class="sm-text">Format: <img src="<?php echo esc_url($icon_url); ?>"
src="<?php echo get_parent_theme_file_uri() . $icon_url; ?>" alt="<?php echo esc_attr($subtype);?>"></p> alt="<?php echo esc_attr($subtype); ?>"></p>
<a href="<?php echo esc_url($post_url); ?>" class="mc-btn-underlined sm-text">View in <a href="<?php echo esc_url($post_url); ?>" class="mc-btn-underlined sm-text">View in
Detail</a> Detail</a>
</div> </div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment