Skip to content

Instantly share code, notes, and snippets.

@Pross
Forked from richsalvucci/resource-loop.php
Last active December 21, 2017 15:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Pross/9ca6b421e10689d94f0f40b8d9b9121c to your computer and use it in GitHub Desktop.
Save Pross/9ca6b421e10689d94f0f40b8d9b9121c to your computer and use it in GitHub Desktop.
Archive loop
<?php
$resource = pods('resource', get_the_id());
$short_description = $resource->display('short_description');
$item_reference_link = $resource->display('item_reference_link');
$button_text = $resource->display('button_text');
$button_icon = $resource->display('button_icon');
$preview_image = $resource->display('preview_image');
var_dump($button_icon);
switch ($button_icon) {
case 'PDF':
$icon = '<i class="fa fa-file-pdf-o" aria-hidden="true"></i>';
break;
case 'Word':
$icon = '<i class="fa fa-file-word-o" aria-hidden="true"></i>';
break;
case 'Image':
$icon = '<i class="fa fa-file-image-o" aria-hidden="true"></i>';
break;
case 'Arrow':
$icon = '<i class="fa fa-arrow-right" aria-hidden="true"></i>';
break;
default:
$icon = '';
break;
}
?>
<div class="col-sm-3">
<div class="resource-tile">
<div class="resource-title">
<?php if($item_reference_link): ?>
<a href="<?php echo $item_reference_link;?>"><h4><?php the_title(); ?></h4></a>
<?php else: ?>
<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><h4><?php the_title(); ?></h4></a>
<?php endif; ?>
</div>
<div class="resource-description">
<p><?php echo $short_description; ?></p>
</div>
<div class="resource-button">
<?php if($file): ?>
<?php if($button_text): ?>
<a href="<?php echo $file;?>" class="std-btn"><?php echo $icon; ?><?php echo $button_text; ?></a>
<?php else: ?>
<a href="<?php echo $file;?>" class="std-btn"><?php echo $icon; ?>Download File</a>
<?php endif; ?>
<?php else: ?>
<?php if($button_text): ?>
<a href="<?php the_permalink(); ?>" class="std-btn"><?php echo $icon; ?><?php echo $button_text; ?></a>
<?php else: ?>
<a href="<?php the_permalink(); ?>" class="std-btn"><?php echo $icon; ?>Resource</a>
<?php endif; ?>
<?php endif; ?>
</div>
</div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment