Skip to content

Instantly share code, notes, and snippets.

@bacalj
Created March 26, 2019 15:50
Show Gist options
  • Save bacalj/fa3d1de2bc794e5010c1f43d554c8995 to your computer and use it in GitHub Desktop.
Save bacalj/fa3d1de2bc794e5010c1f43d554c8995 to your computer and use it in GitHub Desktop.
facet wp template code for outputting posts as foundation cards
<div class="cards-container">
<?php while ( have_posts() ): the_post(); ?>
<div class="card">
<?php the_post_thumbnail(); ?>
<div class="card-content">
<h4><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h4>
<?php
$tags = get_the_tags();
if ($tags){
foreach ($tags as $tag) {
global $wp;
$fwplink = home_url($wp->request) . '/?fwp_tags=' . $tag->slug;
echo '<a style="margin-right:1px" class="small button" href="'. $fwplink .'">';
echo $tag->name;
echo '</a>';
}
}
?>
<p>
<?php the_excerpt(); ?>
</p>
</div>
</div>
<?php endwhile; ?>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment