-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy patharchive.php
executable file
·97 lines (93 loc) · 4.29 KB
/
archive.php
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
<?php get_header();
$dir_path = get_template_directory_uri();
$queriedObj = get_queried_object();
$image_array = get_field( 'thumbnail', $queriedObj );
$category_image = $image_array['url'];
if ( ( empty( $category_image ) ) ) {
$category_image = getRandomImageForCategory();
}
?>
<main id="site-content" role="main">
<div id="twimcast-sidebar-desk" class="show-desktop twimbit-sidebar-desktop">
<div class="twimcast-sidebar-container">
<?php get_template_part( 'templates/twimcast', 'sidebar' ); ?>
</div>
</div>
<amp-sidebar id="twimcast-sidebar" layout="nodisplay" side="right">
<div class="twimcast-sidebar-container">
<?php get_template_part( 'templates/twimcast', 'sidebar' ); ?>
</div>
</amp-sidebar>
<section class="archiveArea">
<div class="postArea-container">
<div id="main-post-area" class="post-div">
<div class="post-container">
<div class="category-meta">
<div class="category-image">
<amp-img width="100" height="100" alt="List icon" lightbox="category"
src="<?php echo $category_image; ?>"></amp-img>
</div>
<div class="category-title">
<h3>
<?php echo $queriedObj->name; ?>
</h3>
<p><?php echo $queriedObj->category_description; ?></p>
</div>
</div>
<div class="recomended-posts" style="border-bottom: 25px solid #f5f5f500;">
<?php
$args = array(
'post_type' => array( 'post' ),
'posts_per_page' => get_option( 'posts_per_page' ),
'cat' => $queriedObj->term_id,
'paged' => get_query_var( 'paged' ) ? absint( get_query_var( 'paged' ) ) : 1
);
$posts = get_posts( $args );
foreach ( $posts as $post ) {
$image_array = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'thumbnail' );
$post_url = get_the_permalink( $post );
$post_title = $post->post_title;
$post_excerpt = $post->post_excerpt;
$post_author = get_the_author_meta( 'display_name', $post->post_author );
$post_category = get_the_category( $post->ID )[0]->name;
$post_date = get_the_date( 'd M', $post );
$post_readTime = get_field( 'length', $post );
$post_type = get_field( 'intent_type', $post );
$featured_image = get_field( 'featured_images', $post )[0];
$post_type = get_field( 'intent_type', $post );
if ( ( empty( $featured_image ) ) ) {
$featured_image = getRandomImageForCategory();
}
?>
<div>
<a href="<?php echo get_the_permalink( $post ); ?>">
<div class="post-list">
<amp-img width="120" height="120" layout="responsive" object-fit="cover"
alt="List icon" src="<?php echo $featured_image; ?>"></amp-img>
<div style="flex:1;margin-left:10px">
<?php include( locate_template( 'templates/widget-templates/list-type.php', false, false ) ); ?>
</div>
</div>
</a>
</div>
<?php
}
?>
</div>
<?php // Previous/next page navigation.
the_posts_pagination(
array(
'prev_text' => __( 'Previous', 'twentytwenty' ),
'next_text' => __( 'Next', 'twentytwenty' ),
'before_page_number' => '<span class="meta-nav screen-reader-text">' . __( 'Page', 'twentytwenty' ) . ' </span>',
)
);
?>
</div>
</div>
<?php get_template_part( 'templates/twimcast', 'right' ) ?>
</div>
</section>
</main><!-- #site-content -->
<?php
get_footer();