-
Notifications
You must be signed in to change notification settings - Fork 0
/
_home-feature-tile-writing.php
39 lines (38 loc) · 1.54 KB
/
_home-feature-tile-writing.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<article class="tile-feature home-feature clear">
<?php // if external URL, open in new tab
$tile_url = get_field('read_more_url');
$tile_url_is_external = get_field('is_external_link');
$protocols = array('http', 'https');
$tile_url_attrs = '';
foreach ($protocols as $pre) {
if (strpos($tile_url, $pre) !== false) {
$tile_url_attrs .= ' rel="external"';
break;
}
}
if ($tile_url_is_external) {
$tile_url_attrs .= ' target="_blank"';
}
?>
<!-- feature thumb -->
<div class="tile-image">
<a class="image-frame feature-thumbnail tile-link" href="<?php echo get_field('read_more_url') ?>" <?php echo $tile_url_attrs ?>>
<?php the_post_thumbnail('home-feature-tile'); ?>
</a>
<figcaption class="caption">
<?php if (get_field('image_credit')) : ?><span class="credit"><?php echo get_field('image_credit') ?></span><?php endif;?>
</figcaption>
</div>
<div class="feature-info">
<h2 class="entry-title feature-title h-sans"><a href="<?php echo get_field('read_more_url') ?>" <?php echo $tile_url_attrs ?>>
<?php the_title() ?></a></h2>
<span class="tile-meta feature-pub-title"><?php echo get_field('publisher') ?></span>
<div class="feature-detail">
<?php if (get_field('home_page_feature_excerpt')) {
echo get_field('home_page_feature_excerpt');
} else { the_excerpt(); } ?>
</div>
<!-- continue -->
<a class="continue" href="<?php echo get_field('read_more_url') ?>" <?php echo $tile_url_attrs ?>>Continue reading <span class="meta-nav">→</span></a>
</div>
</article>