-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontent.php
More file actions
executable file
·95 lines (83 loc) · 2.71 KB
/
content.php
File metadata and controls
executable file
·95 lines (83 loc) · 2.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<?php
/**
* Content template part.
*
* Renders a single post item used in loop-based listing pages.
*
* @package tailwind_wordpress_template
* @since 1.0.0
*/
if (!defined('ABSPATH')) {
exit;
}
?>
<article id="post-<?php the_ID(); ?>" <?php post_class('flex md:flex-col lg:flex-row bg-gray-50 overflow-hidden hover:shadow-lg transition-all duration-300'); ?>>
<?php
$has_thumbnail = has_post_thumbnail();
$default_image_id = '';
if (!$has_thumbnail) {
$default_image_id = get_option('tailwind_wordpress_template_default_image', '');
}
$image_class = 'w-full h-full object-cover';
?>
<div class="event-card-image w-1/2 md:w-full lg:w-1/2">
<a href="<?php echo esc_url(get_permalink()); ?>">
<?php if ($has_thumbnail || $default_image_id) : ?>
<?php
if ($has_thumbnail) {
the_post_thumbnail('large', array('class' => $image_class));
} elseif ($default_image_id) {
echo wp_get_attachment_image($default_image_id, 'large', false, array('class' => $image_class));
}
?>
<?php else: ?>
<div class="w-full h-full bg-gray-100 flex items-center justify-center">
<?php echo esc_html__('No image', 'tailwind_wordpress_template'); ?>
</div>
<?php endif; ?>
</a>
</div>
<div class="entry-info flex flex-col gap-1 w-1/2 md:w-full lg:w-1/2 py-6 px-6">
<div class="entry-meta">
<span class="posted-on">
<time datetime="<?php echo esc_attr(get_the_date('c')); ?>">
<?php echo esc_html(get_the_date('Y.m.d')); ?>
</time>
</span>
</div>
<header class="entry-header mb-3">
<?php
if (is_sticky() && is_home() && !is_paged()) {
printf(
'<span class="inline-block bg-yellow-400 text-yellow-900 text-xs font-semibold px-2 py-1 rounded mb-2">%s</span>',
__('Featured', 'tailwind_wordpress_template')
);
}
$title_class = 'entry-title truncate overflow-hidden text-xl font-medium';
if (is_singular()) {
the_title('<h1 class="' . $title_class . '">', '</h1>');
} else {
the_title(
sprintf(
'<h2 class="' . $title_class . '"><a href="%s" class="truncate no-underline hover:underline" rel="bookmark">',
esc_url(get_permalink())
),
'</a></h2>'
);
}
?>
</header>
<div class="entry-summary text-sm text-justify break-all line-clamp-4 h-[6em]">
<?php the_excerpt(); ?>
</div>
<footer class="entry-footer mt-3">
<?php
get_template_part('template-parts/content-readmore-button', null, array(
'link' => get_permalink(),
'text' => 'Read',
'align' => 'left',
));
?>
</footer>
</div>
</article>