-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy patharchive.php
More file actions
232 lines (216 loc) · 12.3 KB
/
Copy patharchive.php
File metadata and controls
232 lines (216 loc) · 12.3 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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
<?php
get_header();
$blog_layouts_side_bar;
$blog_layouts_archive_title = esc_html__('Archive', 'blog-layouts');
$blog_layouts_archive_post_list_style = 'cards';
$blog_layouts_sidebar_layout_setting = get_theme_mod('search_sidebar_layout', 'social');
if (is_author()) {
$blog_layouts_side_bar = get_theme_mod('author_page_sidebar', true);
$blog_layouts_sidebar_layout_setting = get_theme_mod('author_page_sidebar_layout', 'social');
$blog_layouts_archive_title = get_the_author();
$blog_layouts_archive_post_list_style = get_theme_mod('author_posts_style', 'cards');
} elseif (is_tag()) {
$blog_layouts_side_bar = get_theme_mod('tags_sidebar', true);
$blog_layouts_sidebar_layout_setting = get_theme_mod('tags_sidebar_layout', 'social');
$blog_layouts_archive_title = single_tag_title('', false);
$blog_layouts_archive_post_list_style = get_theme_mod('tag_list_style', 'cards');
} elseif (is_category()) {
$blog_layouts_side_bar = get_theme_mod('category_sidebar', true);
$blog_layouts_sidebar_layout_setting = get_theme_mod('category_sidebar_layout', 'social');
$blog_layouts_archive_title = single_cat_title('', false);
$blog_layouts_archive_post_list_style = get_theme_mod('category_list_style', 'cards');
} elseif (is_date()) {
$blog_layouts_side_bar = get_theme_mod('date_sidebar', true);
$blog_layouts_sidebar_layout_setting = get_theme_mod('date_sidebar_layout', 'social');
if (is_day()) {
$blog_layouts_archive_title = esc_html__('Archive for', 'blog-layouts') . ' ' . get_the_date();
} elseif (is_month()) {
$blog_layouts_archive_title = esc_html__('Archive for', 'blog-layouts') . ' ' . get_the_date('F Y');
} elseif (is_year()) {
$blog_layouts_archive_title = esc_html__('Archive for', 'blog-layouts') . ' ' . get_the_date('Y');
}
$blog_layouts_archive_post_list_style = get_theme_mod('date_list_style', 'cards');
} elseif (is_search()) {
$blog_layouts_side_bar = get_theme_mod('search_sidebar', true);
$blog_layouts_sidebar_layout_setting = get_theme_mod('search_sidebar_layout', 'social');
$blog_layouts_archive_post_list_style = get_theme_mod('searchresults_style', 'cards');
} elseif (is_archive()) {
$blog_layouts_side_bar = get_theme_mod('archive_sidebar', true);
} else {
$blog_layouts_side_bar = true;
}
?>
<?php if (!is_author() || is_author() && !get_theme_mod('author_header', true)) { ?>
<section class="blog_layouts_hero">
<header>
<h1>
<?php echo $blog_layouts_archive_title; ?>
</h1>
</header>
</section>
<?php } ?>
<!-- author header -->
<?php if (is_author() && get_theme_mod('author_header', true)) {
$blog_layouts_author_id = get_the_author_meta('ID');
$blog_layouts_author_name = esc_html(get_the_author_meta('display_name'));
$blog_layouts_author_description = esc_html(get_the_author_meta('description'));
$blog_layouts_author_website = esc_url(get_the_author_meta('user_url'));
$blog_layouts_author_posts_count = count_user_posts($blog_layouts_author_id);
$blog_layouts_author_roles = get_the_author_meta('roles');
$blog_layouts_user_registered = get_the_author_meta('blog_layouts_user_registered');
$blog_layouts_timestamp = strtotime($blog_layouts_user_registered);
$blog_layouts_formatted_date = date_i18n(get_option('date_format'), $blog_layouts_timestamp);
// Avatar
$blog_layouts_image_size = esc_attr(get_theme_mod('image_size_setting', '150'));
$blog_layouts_author_avatar = get_avatar($blog_layouts_author_id, $blog_layouts_image_size);
?>
<section class="blog_layouts_post_author_headline_section">
<header>
<div class="blog_layouts_author_row_1">
<?php echo $blog_layouts_author_avatar ?>
<div class="blog_layouts_author_headline_container">
<h1>
<?php
if (is_author()) {
the_post();
echo get_the_author(); // Author name
rewind_posts();
} ?>
</h1>
<ul class="blog_layouts_author_stats">
<?php if (get_theme_mod('author_page_role', true)) { ?>
<li>
<div class="blog_layouts_author_stats_data"> <?php echo $blog_layouts_author_roles[0] ?></div>
<label class="blog_layouts_author_stats_label"><?php echo esc_html(__('Role', 'blog-layouts')) ?></label>
</li>
<?php } ?>
<?php if (get_theme_mod('author_registration_date', true)) { ?>
<li>
<div class="blog_layouts_author_stats_data">
<?php
$registration_date = get_the_author_meta('blog_layouts_user_registered', $blog_layouts_author_id);
$blog_layouts_formatted_date = date_i18n('d.m.Y', strtotime($registration_date));
?>
<time datetime="<?php echo date('Y-m-d', strtotime($registration_date)); ?>"><?php echo $blog_layouts_formatted_date; ?></time>
</div>
<label class="blog_layouts_author_stats_label">
<?php echo esc_html(__('Registration date', 'blog-layouts')); ?>
</label>
</li>
<?php } ?>
<?php if (get_theme_mod('author_number_of_posts', true)) { ?>
<li>
<div class="blog_layouts_author_stats_data"> <?php echo $blog_layouts_author_posts_count ?></div>
<label class="blog_layouts_author_stats_label"><?php echo esc_html(__('Number of posts', 'blog-layouts')) ?></label>
</li>
<?php } ?>
</ul>
</div>
</div>
</header>
<nav class="blog_layouts_author_nav">
<ul>
<li>
<button id="blog_layouts_author_posts" onclick="click_author_posts()"><?php echo esc_html(__('Posts', 'blog-layouts')) ?></button>
</li>
<?php if (get_theme_mod('author_page_latest_comments', true)) { ?>
<li>
<button id="blog_layouts_author_comments" onclick="click_author_comments()"><?php echo esc_html(__('Comments', 'blog-layouts')) ?></button>
</li>
<?php } ?>
</ul>
</nav>
<?php if (!empty($blog_layouts_author_description)) : ?>
<div class="blog_layouts_author_bio_container">
<div class="blog_layouts_author_bio">
<h2><?php printf(esc_html__('About %s:', 'blog-layouts'), get_the_author()); ?></h2>
<p><?php echo $blog_layouts_author_description; ?></p>
<?php if (get_theme_mod('blog_layouts_author_website', true) && $blog_layouts_author_website) { ?>
<a class="blog_layouts_author_website" href="<?php echo $blog_layouts_author_website; ?>" target="_blank">🌐
<?php echo esc_html(__('Website', 'blog-layouts')) ?></a>
<?php } ?>
</div>
</div>
<?php endif; ?>
</section>
<?php } ?>
<main role="main" <?php if ($blog_layouts_side_bar) echo 'class="blog_layouts_has_sidebar"' ?>>
<section class="blog_layouts_content_spacer blog_layouts_content_spacer_feed blog_layouts_content_and_sidebar_grid">
<?php if (is_author()) {; ?>
<div class="blog_layouts_autor_content">
<div class="blog_layouts_author_comments_container">
<?php
$blog_layouts_args = array(
'user_id' => $blog_layouts_author_id,
'number' => 5, // Number of comments
);
$blog_layouts_author_comments = get_comments($blog_layouts_args);
?>
<h3 class="blog_layouts_author_last_comments_headline">
<?php echo __('Last comments from', 'blog-layouts') . ' ' . $blog_layouts_author_name; ?></h3>
<ol class="has-avatars has-dates has-excerpts wp-block-latest-comments">
<?php
if ($blog_layouts_author_comments) {
foreach ($blog_layouts_author_comments as $comment) {
echo '<li class="wp-block-latest-comments__comment">';
echo get_avatar($comment->comment_author_email, 48); // Gravatar-Avatar
echo '<article>';
echo '<footer class="wp-block-latest-comments__comment-meta">';
echo '<a class="wp-block-latest-comments__comment-author" href="' . esc_url($comment->comment_author_url) . '">' . $comment->comment_author . '</a>';
echo ' <a class="wp-block-latest-comments__comment-link" href="' . esc_url(get_comment_link($comment)) . '">' . get_the_title($comment->comment_post_ID) . '</a>';
echo '<time datetime="' . esc_attr(get_comment_date('c', $comment)) . '" class="wp-block-latest-comments__comment-date">' . get_comment_date('j. F Y', $comment) . '</time>';
echo '</footer>';
echo '<div class="wp-block-latest-comments__comment-excerpt">';
echo '<p>' . get_comment_excerpt($comment) . '</p>'; // Comment snippet
echo '</div>';
echo '</article>';
echo '</li>';
}
} else {
echo __('No comments found.', 'blog-layouts');
}
?>
</ol>
<?php } ?>
</div>
<?php
if (have_posts()) {
global $wp_query;
$wp_query->set('paged', 1);
require_once get_template_directory() . '/template-parts/layout-manager.php';
echo blog_layouts_display_posts_list($wp_query, $blog_layouts_archive_post_list_style);
// Pagination
$blog_layouts_total_pages = $wp_query->max_num_pages;
if ($blog_layouts_total_pages > 1) {
echo '<div class="blog_layouts_pagination blog_layouts_shadow">';
echo '<div class="blog_layouts_pagination_content">';
echo '<div class="blog_layouts_pagination_controls">';
previous_posts_link(__('« Previous', 'blog-layouts'));
echo '</div>';
echo '<div class="blog_layouts_pagination_pages">';
echo paginate_links(array(
'total' => $wp_query->max_num_pages,
'current' => $paged,
'prev_next' => false,
));
echo '</div>';
echo '<div class="blog_layouts_pagination_controls">';
next_posts_link(__('Next »', 'blog-layouts'), $wp_query->max_num_pages);
echo '</div>';
echo '</div>';
}
} else {
echo esc_html__('No posts found.', 'blog-layouts');
}
?>
</div>
</div>
</section>
</main>
<?php
if ($blog_layouts_side_bar) {
echo '<aside id="blog_layouts_sidebar" class="' . 'blog_layouts_sidebar_layout_' . esc_attr($blog_layouts_sidebar_layout_setting) . '">';
get_sidebar();
echo '</aside>';
}
get_footer(); ?>