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
</div>
<div class="resource-content">
<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>
<P class="sm-text">
<?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">
<?php
$downloadable_resource = get_field('downloadable_resource', $post_id) ?: [];
......@@ -81,28 +82,28 @@ if (isset($resources_listing) && is_array($resources_listing) && !empty($resourc
$subtype = $upload_downloadable_resource['subtype'];
switch (strtolower($subtype)) {
case 'pdf':
$icon_url = '/assets/img/pdf-icon.png';
$icon_url = get_field('pdf_image', 'option');
break;
case 'doc':
case 'docx':
$icon_url = '/assets/img/word-icon.png';
$icon_url = get_field('doc_image', 'option');
break;
case 'xls':
case 'xlsx':
$icon_url = '/assets/img/excel-icon.png';
$icon_url = get_field('xls_image', 'option');
break;
case 'ppt':
case 'pptx':
$icon_url = '/assets/img/ppt-icon.png';
$icon_url = get_field('ppt_image', 'option');
break;
default:
$icon_url = '/assets/img/pdf-icon.png';
$icon_url = get_field('default_image', 'option');
}
endif;
endif;
?>
<p class="sm-text">Format: <img
src="<?php echo get_parent_theme_file_uri() . $icon_url; ?>" alt="<?php echo esc_attr($subtype);?>"></p>
<p class="sm-text">Format: <img src="<?php echo esc_url($icon_url); ?>"
alt="<?php echo esc_attr($subtype); ?>"></p>
<a href="<?php echo esc_url($post_url); ?>" class="mc-btn-underlined sm-text">View in
Detail</a>
</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