Card with no image | Card with an image | Card with an icon
|
|---|---|---|
Card pulling a post (will also display featured image if there is one) | Card with stretch link and no CTA | Card without stretch link and no CTA (no use cases yet) |
Use when displaying content.
Title
Subtitle
![]()
Image
Microtitle
![]()
Content
Link
CTA Style
Stretch Link
Remove CTA
Enable Card Shadows
To implement a Remove CTA option on other cards:
<?php if ($link_url && $remove_cta) : ?><a href="<?php echo esc_url($link_url); ?>" class="<?php if ($stretch_link) : ?>stretched-link stretch-link-heading<?php endif; ?> " <?php if ($link_target) : ?>target="<?php echo esc_attr($link_target); ?>" rel="external nofollow noreferrer" <?php endif; ?>><?php endif; ?>
<?php if ($title) : ?><h<?php echo ($section_title_heading_size + 1); ?> class="card-title <?php if ($link_url && $remove_cta && $stretch_link) : ?>heading-link<?php endif?>"><?php echo $title; ?></h<?php echo ($section_title_heading_size + 1); ?>><?php endif; ?>
<?php if ($link_url && $remove_cta) : ?></a><?php endif; //if remove CTA is checked, place link around title/heading and add 'stretch-link-heading' class to the link and 'heading-link' class to the heading for styling?>
|
<?php if ($link_url && !$remove_cta) : //if remove CTA is NOT checked, add CTA link at the bottom?>
<div class="card-footer">
<a href="<?php echo esc_url($link_url); ?>" class="btn <?php the_sub_field('cta_style'); ?> <?php if ($stretch_link) : ?>stretched-link<?php endif; ?>" <?php if ($link_target) : ?>target="<?php echo esc_attr($link_target); ?>" rel="external nofollow noreferrer" <?php endif; ?> <?php if ($post_object) : ?>aria-label="Read the full article: <?php echo $title ?>"<?php endif; //added aria label for more accessible link text?>><?php echo esc_html($link_title); ?></a>
</div>
<?php endif; ?> |
Test the code on the front end to make sure it works.