Skip to content

Instantly share code, notes, and snippets.

@stegel
Created September 10, 2018 19:57
Show Gist options
  • Save stegel/dcab78a878eaec3412ffda149cbcbf65 to your computer and use it in GitHub Desktop.
Save stegel/dcab78a878eaec3412ffda149cbcbf65 to your computer and use it in GitHub Desktop.
responsive-threats.php
<div id="results" class="asd-results">
<?php while ( have_posts() ): the_post(); ?>
<div class="asd-result">
<?php if ( has_post_thumbnail() ) : ?>
<div class="asd-result__thumb">
<a href="<?php the_permalink(); ?>"><?php the_post_thumbnail("medium") ?></a>
</div>
<?php endif ?>
<div class="asd-result__content">
<h3 class="asd-result__title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
<?php
$the_excerpt = get_the_content();
$the_excerpt = preg_replace("~(?:\[/?)[^/\]]+/?\]~s", '', $the_excerpt);
$the_excerpt = strip_tags($the_excerpt);
$the_excerpt = substr($the_excerpt,0,700);
?>
<p class="asd-result__content"><?php echo $the_excerpt; ?></p>
<p class="asd-result__attachments">
<?php if( get_field("source",$post->ID) ) { ?>
<a href="<?php the_field('source',$post->ID); ?>"><i class="fontawesome-icon fa-link fas circle-no" style="font-size:18px;margin-right:9px;color:#0f6494;"></i></a>
<?php } ?>
<?php if( get_field("source_2",$post->ID) ) { ?>
<a href="<?php the_field('source_2',$post->ID); ?>"><i class="fontawesome-icon fa-link fas circle-no" style="font-size:18px;margin-right:9px;color:#0f6494;"></i></a>
<?php } ?>
<?php if( get_field("source_3",$post->ID) ) { ?>
<a href="<?php the_field('source_3',$post->ID); ?>"><i class="fontawesome-icon fa-link fas circle-no" style="font-size:18px;margin-right:9px;color:#0f6494;"></i></a>
<?php } ?>
</div>
</div>
<?php endwhile; ?>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment