Commit 12611fef by rajshah

fix the xls document type in resource listing block

parent 912412bf
......@@ -6,47 +6,47 @@ if (isset($resources_listing) && is_array($resources_listing) && !empty($resourc
if ($enable_resources_listing):
$resources_items = $resources_listing['resources_items'] ?: [];
if (isset($resources_items) && is_array($resources_items) && !empty($resources_items)):
?>
<section class="resource-listing py-80 makura-new">
<div class="container">
<div class="row">
<div class="col-lg-4 col-xl-3">
<div class="toc slide-up">
<div class="toc-title">
<h6>Table of Content</h6>
</div>
<div class="category-list">
<ul>
<?php foreach ($resources_items as $ri => $res_item):
?>
<section class="resource-listing py-80 makura-new">
<div class="container">
<div class="row">
<div class="col-lg-4 col-xl-3">
<div class="toc slide-up">
<div class="toc-title">
<h6>Table of Content</h6>
</div>
<div class="category-list">
<ul>
<?php foreach ($resources_items as $ri => $res_item):
$title = $res_item['title'] ?: '';
?>
<li class="<?php echo ($ri === 0) ? 'active' : ''; ?>"><a href="#" class="sm-text"
data-target="<?php echo strtolower(str_replace(' ', '-', $title)); ?>"><?php echo esc_html($title); ?></a>
</li>
<?php endforeach; ?>
</ul>
</div>
</div>
</div>
<div class="col-lg-8 col-xl-9">
<div class="resource-wrapper">
<?php foreach ($resources_items as $ri => $res_item):
?>
<li class="<?php echo ($ri === 0) ? 'active' : ''; ?>"><a href="#" class="sm-text"
data-target="<?php echo strtolower(str_replace(' ', '-', $title)); ?>"><?php echo esc_html($title); ?></a>
</li>
<?php endforeach; ?>
</ul>
</div>
</div>
</div>
<div class="col-lg-8 col-xl-9">
<div class="resource-wrapper">
<?php foreach ($resources_items as $ri => $res_item):
$title = $res_item['title'] ?: '';
$desc = $res_item['desc'] ?: '';
$select_resources = $res_item['select_resources'] ?: [];
?>
<div class="resource-block slide-up" id="<?php echo strtolower(str_replace(' ', '-', $title)); ?>">
<div class="section-title">
<?php if (!empty($title)): ?>
<h2><?php echo $title; ?></h2><?php endif; ?>
<?php if (!empty($desc)):
?>
<div class="resource-block slide-up" id="<?php echo strtolower(str_replace(' ', '-', $title)); ?>">
<div class="section-title">
<?php if (!empty($title)): ?>
<h2><?php echo $title; ?></h2><?php endif; ?>
<?php if (!empty($desc)):
echo $desc ?: '';
endif; ?>
</div>
<?php if (!empty($select_resources) && isset($select_resources) && is_array($select_resources)): ?>
<div class="resources">
<div class="row">
<?php foreach ($select_resources as $sel_res):
</div>
<?php if (!empty($select_resources) && isset($select_resources) && is_array($select_resources)): ?>
<div class="resources">
<div class="row">
<?php foreach ($select_resources as $sel_res):
if ($sel_res instanceof WP_Post) {
$post_id = $sel_res->ID;
$post_url = get_permalink($post_id);
......@@ -57,25 +57,25 @@ if (isset($resources_listing) && is_array($resources_listing) && !empty($resourc
}
$post_content = $sel_res->post_content;
$post_excerpt = $sel_res->post_excerpt;
?>
<div class="col-sm-6">
<div class="resource-item d-sm-flex flex-sm-column flex-xl-row justify-content-xl-start slide-up">
<div class="resource-image">
<a href="<?php echo esc_url($post_url); ?>" class="d-block">
<img src="<?php echo esc_url($post_thumbnail_url); ?>"
alt="<?php echo esc_attr($post_title); ?>" class="img-fluid">
</a>
</div>
<div class="resource-content">
<div class="rc-detail">
<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>
<div class="format-and-btn-wrapper d-flex justify-content-between">
<?php
?>
<div class="col-sm-6">
<div class="resource-item d-sm-flex flex-sm-column flex-xl-row justify-content-xl-start slide-up">
<div class="resource-image">
<a href="<?php echo esc_url($post_url); ?>" class="d-block">
<img src="<?php echo esc_url($post_thumbnail_url); ?>"
alt="<?php echo esc_attr($post_title); ?>" class="img-fluid">
</a>
</div>
<div class="resource-content">
<div class="rc-detail">
<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>
<div class="format-and-btn-wrapper d-flex justify-content-between">
<?php
$downloadable_resource = get_field('downloadable_resource', $post_id) ?: [];
if (isset($downloadable_resource) && is_array($downloadable_resource) && !empty($downloadable_resource)):
$enable_downloadable_resources = $downloadable_resource['enable_downloadable_resources'];
......@@ -85,47 +85,50 @@ if (isset($resources_listing) && is_array($resources_listing) && !empty($resourc
$subtype = $upload_downloadable_resource['subtype'];
switch (strtolower($subtype)) {
case 'pdf':
$icon_url = get_field('pdf_image', 'option');
$icon = 'PDF';
break;
case 'doc':
case 'docx':
$icon_url = get_field('doc_image', 'option');
$icon = 'DOC';
break;
case 'xls':
case 'xlsx':
case 'vnd.ms-excel':
case 'vnd.openxmlformats-officedocument.spreadsheetml.sheet':
$icon_url = get_field('xls_image', 'option');
$icon = 'XLS';
break;
case 'ppt':
case 'pptx':
case 'vnd.openxmlformats-officedocument.presentationml.presentation':
$icon_url = get_field('ppt_image', 'option');
$icon = 'PPT';
break;
default:
$icon_url = get_field('default_image', 'option');
$icon = 'PDF';
}
endif;
endif;
?>
<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>
<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>
</div>
</div>
</div>
<?php }
endforeach; ?>
</div>
</div>
</div>
<?php endif; ?>
</div>
</div>
<?php }endforeach; ?>
<?php endforeach; ?>
</div>
</div>
<?php endif; ?>
</div>
<?php endforeach; ?>
</div>
</div>
</div>
</div>
</section>
<?php endif; endif; endif; ?>
</section>
<?php endif;
endif;
endif; ?>
<!-- !Resources - Resources Listing -->
\ No newline at end of file
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