Skip to content

Instantly share code, notes, and snippets.

@dospuntocero
Created February 26, 2020 02:21
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 dospuntocero/b9c82c5c86a1d302d8c758fd7806d83a to your computer and use it in GitHub Desktop.
Save dospuntocero/b9c82c5c86a1d302d8c758fd7806d83a to your computer and use it in GitHub Desktop.
cutting the title and content for showing even smaller excerpts they they dont fit in the design
<div class="cell medium-4">
<div class="media__teaser">
<p class="media__teaser--type">
<?php echo get_the_category()[0]->name; ?>
</p>
<div class="media__teaser--title">
<?php echo mb_strimwidth(get_the_title(), 0, 50, '...'); ?>
</div>
<div class="media__teaser--img" style="background-image: url(<?php echo get_the_post_thumbnail_url(); ?>);">
<div class="media__teaser--date">
<p class="month"><?php echo get_the_date( 'M' );?></p>
<p class="day"><?php echo get_the_date( 'D' );?></p>
<p class="year"><?php echo get_the_date( 'j' );?></p>
</div>
</div>
<div class="media__teaser--excerpt">
<?php echo mb_strimwidth(get_the_excerpt(), 0, 200, '...'); ?>
</div>
<a class="button button__white" href="<?php the_permalink(); ?>">learn more</a>
</div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment