Skip to content

Instantly share code, notes, and snippets.

@divienginesupport
Created July 31, 2023 13:38
Show Gist options
  • Save divienginesupport/2a2a2867aee17fd19f8ffb8f81203cb9 to your computer and use it in GitHub Desktop.
Save divienginesupport/2a2a2867aee17fd19f8ffb8f81203cb9 to your computer and use it in GitHub Desktop.
Divi custom coded Loop Layout Template - PHP
<?php
if ( ! defined( 'ABSPATH' ) ) exit;
// get the post ID
$post_id = get_the_ID();
?>
<article id="<?php echo $post_id; ?>" <?php post_class( 'et_pb_post clearfix grid-item'); ?>>
<div class="card">
<div class="card-image">
<?php echo get_the_post_thumbnail( $post_id, 'large', array( 'class' => 'img-responsive' ) ); ?>
</div>
<div class="event-schedule">
<div class="event-date">
<?php the_field( 'event_date' ); ?>
</div>
<div class="event-time">
<?php the_field( 'event_start_time' ); ?><?php if(get_field('event_end_time')) { echo ' - '; the_field( 'event_end_time' ); } ?>
</div>
</div>
<div class="event-details">
<h2><?php the_title(); ?></h2>
<div class="event-address">
<?php the_field( 'event_address' ); ?>
</div>
</div>
<?php if ( have_rows( 'icon_list_tooltip' ) ) : ?>
<div class="event-icons-title"><?php the_field( 'icon_list_title' ); ?></div>
<div class="event-icons">
<?php while ( have_rows( 'icon_list_tooltip' ) ) : the_row(); ?>
<div class="event-icon" data-tooltip="<?php the_sub_field( 'tooltip' ); ?>">
<img src="<?php the_sub_field( 'icon' ); ?>" />
</div>
<?php endwhile; ?>
</div>
<?php endif; ?>
<div class="event-cta-row">
<a href="<?php the_permalink(); ?>" class="event-details-cta">Details</a>
<?php if(get_field( 'ticket_link' )) : ?>
<a href="<?php the_field( 'ticket_link' ); ?>" class="event-tickets-cta">Buy Tickets</a>
<?php endif; ?>
</div>
</div>
</article>
<?php
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment