-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpage.php
More file actions
101 lines (82 loc) · 3.91 KB
/
Copy pathpage.php
File metadata and controls
101 lines (82 loc) · 3.91 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
95
96
97
98
99
100
101
<?php
get_header();
$show_featured_content = get_field('show_featured_content');
$featured_content = get_field('featured_content');
?>
<main id="main" class="cariloop">
<section class="interior-wrapper">
<?php get_template_part('templates/content', 'page'); ?>
</section>
<?php if ($show_featured_content): ?>
<section class="wrapper">
<div class="featured-content">
<h2 class="text-center">Featured Content</h2>
<div class="flex gap-50">
<?php if($featured_content): ?>
<?php while( have_rows('featured_content') ): the_row();?>
<?php
$post_object = get_sub_field('post_object');
$content_post = get_post($post_object);
$content = $content_post->post_content;
$content = apply_filters('the_content', $content);
$content = str_replace(']]>', ']]>', $content);
$title = get_the_title($post_object);
if (get_the_author($post_object)) {
$author = get_the_author($resources_query->ID);
} else {
$author = 'The Cariloop Team';
}
$date = get_the_date("F j, Y", $post_object);
$thumbnail = get_the_post_thumbnail($post_object);
$link = get_the_permalink($post_object);
?>
<a class="post" href="<?php echo $link; ?>">
<div>
<?php echo $thumbnail; ?>
<h4><?php echo mb_strimwidth($title, 0, 60, '...'); ?></h4>
<p><?php echo wp_trim_words($content, 15, '...'); ?></p>
</div>
<p class="author">The Cariloop Team <span class="orange">|</span> <?php echo $date; ?></p>
</a>
<?php endwhile; ?>
<?php else: ?>
<?php
$args = array(
'post_type' => 'post',
'post_status' => 'publish',
'category' => 'news',
'orderby' => 'date',
'posts_per_page' => 3,
);
$post_query = new WP_Query($args);
if (get_the_author()) {
$author = get_the_author();
} else {
$author = 'The Cariloop Team';
}
$date = get_the_date("F j, Y");
?>
<?php if($post_query->have_posts() ): ?>
<?php while($post_query->have_posts() ): ?>
<?php $post_query->the_post();
$date = get_the_date("F j, Y", $post_query->ID);
?>
<a class="post" href="<?php the_permalink(); ?>">
<div>
<?php the_post_thumbnail( 'full' ); ?>
<h4><?php echo mb_strimwidth(get_the_title(), 0, 60, '...'); ?></h4>
<p><?php echo wp_trim_words(get_the_content(), 15, '...'); ?></p>
</div>
<p class="author">The Cariloop Team <span class="orange">|</span> <?php echo $date; ?></p>
</a>
<?php endwhile; ?>
<?php endif;
wp_reset_query();
?>
<?php endif; ?>
</div>
</div>
</section>
<?php endif; ?>
</main>
<?php get_footer(); ?>