content-advent_day.php 1.22 KB
Newer Older
1 2
<div class="calendar_day_cell" data-day-name="<?php echo esc_attr( $post->post_name ); ?>">
	<h2 <?php post_class( 'middle' ) ?>>
Mike Little's avatar
Mike Little committed
3
		<?php the_title(); ?>
Mike Little's avatar
Mike Little committed
4 5 6 7 8 9 10
	</h2>

	<?php
	$image   = get_field( 'acd_image' );
	$video   = get_field( 'acd_video' );
	$alt     = get_field( 'acd_alt_description' );
	$alt_tag = ! empty( $alt ) ? sprintf( 'alt="%s"', esc_attr( $alt ) ) : '';
11

Mike Little's avatar
Mike Little committed
12 13
	if ( isset( $image ) && $image['id'] ) {
		?>
14 15 16
		<div class="day-image hidden">
			<img id="advent-image" src="<?php echo wp_get_attachment_url( $image['id'] ); ?>" <?php echo $alt_tag; ?>>
		</div>
Mike Little's avatar
Mike Little committed
17 18
		<?php
	} elseif ( isset( $video ) ) {
19
		?>
20
		<div class="day-image hidden embed-container">
21 22 23
			<?php echo $video; ?>
		</div>
		<?php
Mike Little's avatar
Mike Little committed
24
	}
25

Mike Little's avatar
Mike Little committed
26 27 28
	$motto         = get_field( 'acd_short_message' );
	$joke_question = get_field( 'acd_joke_question' );
	$joke_answer   = get_field( 'acd_joke_answer' );
29

Mike Little's avatar
Mike Little committed
30 31
	switch ( get_field( 'acd_motto_or_joke' ) ) {
		case 'motto':
Mike Little's avatar
Mike Little committed
32
			?>
33
			<p class="advent-motto hidden"><?php echo esc_html( $motto ); ?></p>
Mike Little's avatar
Mike Little committed
34
			<?php
Mike Little's avatar
Mike Little committed
35 36 37
			break;
		case 'joke':
			?>
38 39
			<p class="advent-motto hidden"><?php echo esc_html( $joke_question ); ?></p>
			<p class="advent-joke-answer hidden2"><?php echo esc_html( $joke_answer ); ?></p>
Mike Little's avatar
Mike Little committed
40 41 42 43 44 45

			<?php
			break;
	}
	?>

Mike Little's avatar
Mike Little committed
46
</div>