1 В избранное 0 Ответвления 0

OSCHINA-MIRROR/qwqdanchun-win10exp

Присоединиться к Gitlife
Откройте для себя и примите участие в публичных проектах с открытым исходным кодом с участием более 10 миллионов разработчиков. Приватные репозитории также полностью бесплатны :)
Присоединиться бесплатно
Клонировать/Скачать
page-inspiration.php 3.8 КБ
Копировать Редактировать Web IDE Исходные данные Просмотреть построчно История
qwqdanchun Отправлено 29.03.2020 17:59 227bb55
<?php
/**
* Template Name: Inspiration
*/
$post_list_class =
$sidebar_pos == 'none' ? 'col-10 col-md-12' : 'col-8 col-md-12';
$sidebar_class = $sidebar_pos == 'none' ? 'd-none' : 'col-4 col-md-12';
$main_class = $sidebar_pos == 'left' ? 'flex-rev' : '';
$paged = get_query_var('paged') ? get_query_var('paged') : 1;
query_posts([
"post_type" => "inspiration",
"post_status" => "publish",
"posts_per_page" => 30,
"paged" => $paged
]);
if (have_posts()) {
$post_list = [];
while (have_posts()) {
the_post();
$post_author_id = get_post_field('post_author', $post->ID);
global $post_list;
$post_item = [
'post_id' => $post->ID,
'post_title' => get_the_title($post->ID),
'post_date' => get_the_date(get_option('date_format'), $post->ID),
'post_year' => get_the_date('Y', $post->ID),
'post_month' => get_the_date('m', $post->ID),
'post_comments' => get_comments_number($post->ID),
'post_link' => get_the_permalink($post->ID),
'post_image' => wp_get_attachment_url(get_post_thumbnail_id($post->ID)),
'post_image_alt' => get_post_meta(
get_post_thumbnail_id($post->ID),
'_wp_attachment_image_alt',
true
),
'post_author' => get_the_author_meta('display_name', $post_author_id),
'post_author_avatar' => get_avatar(
get_the_author_email(),
64,
get_option("avatar_default"),
"",
[
"class" => "inspiration-avatar"
]
),
'post_category' => wp_get_post_categories($post->ID),
'post_tag' => wp_get_post_tags($post->ID),
'post_excerpt' => get_the_excerpt($post->ID),
'post_content' => get_the_content()
];
if (
$post_item['post_image'] == false &&
theme_get_other_thumbnail($post)
) {
$post_item['post_image'] = theme_get_other_thumbnail($post);
}
$post_list[] = $post_item;
}
}
$count = wp_count_posts("inspiration")->publish;
wp_reset_query();
get_header();
the_post();
?>
<div class="layui-row content">
<div class="layui-col-md2 sidebar <?php get_self_adaption_css() ?>">
<?php get_sidebar(); ?>
</div>
<div class="layui-col-md10 post-content">
<div id="main-content">
<main class="ori-container columns <?php echo $main_class; ?> grid-md">
<section class="inspiration-list column <?php echo $post_list_class; ?>">
<article <?php post_class("p-post-content"); ?> id="post-<?php the_ID(); ?>">
<?php the_content(); ?>
</article>
<ul class="inspiration">
<?php foreach ((array)$post_list as $item): ?>
<li class="inspiration-card">
<?php echo $item['post_author_avatar']; ?>
<div class="inspiration-right">
<div class="inspiration-title"><?php echo $item[
'post_title'
]; ?></div>
<div class="inspiration-content">
<?php echo $item['post_content']; ?>
</div>
<div class="inspiration-footer">
<span class="inspiration-footer-left">
<i class="fa fa-paper-plane-o"></i>
<span><?php echo $item['post_author']; ?></span>
</span>
<span class="inspiration-footer-right">
<i class="fa fa-calendar"></i>
<time><?php echo $item['post_date']; ?></time>
</span>
</div>
</div>
</li>
<?php endforeach; ?>
</ul>
</section>
<aside class="column ori-sidebar <?php echo $sidebar_class; ?>">
<?php get_sidebar(); ?>
</aside>
</main>
</div>
</div>
</div>
</div>
</body>
<?php get_footer() ?>
<?php wp_footer(); ?>
</html>

Опубликовать ( 0 )

Вы можете оставить комментарий после Вход в систему

1
https://api.gitlife.ru/oschina-mirror/qwqdanchun-win10exp.git
git@api.gitlife.ru:oschina-mirror/qwqdanchun-win10exp.git
oschina-mirror
qwqdanchun-win10exp
qwqdanchun-win10exp
master