需要你的帮助,不知道该怎么办。
<?php
/**
* Template Name: Home Page
*
* This is the template that displays all widgets included in homepage widget area.
*
* @package Mystery Themes
* @subpackage News Portal Pro
* @since 1.0.0
*/
get_header();
/*-----------------------------------------------------------------------------------------------------------------------*/
/**
* Home Top Section Area
*
* @since 1.0.0
*/
if (is_active_sidebar(\'np_home_top_section_area\')) {
?>
<div class="np-home-top-section np-clearfix">
<?php dynamic_sidebar(\'np_home_top_section_area\'); ?>
</div><!-- .np-home-top-section -->
<?php
}
/*-----------------------------------------------------------------------------------------------------------------------*/
/**
* Home Middle Section Area
*
* @since 1.0.0
*/
$top_title = get_field(\'top_news_title\', 1620);
$top_posts = get_field(\'top_news_posts\', 1620);
?>
<div class="home_top_block">
<div class="np-home-middle-section np-clearfix">
<div class="left_section">
<?php if (!empty($top_posts) && $top_title): ?>
<div class="np-home-top-section np-clearfix">
<h2 class="np-block-title">
<span class="np-title"><?= $top_title ?></span>
</h2>
<div class="top_block">
<?php foreach ($top_posts as $key => $post) { ?>
<div class="post_item">
<div class="np-slide-thumb">
<a href="<?php the_permalink(); ?>">
<?= get_the_post_thumbnail($post) ?>
</a>
</div>
<div class="description">
<h3 class="post-title large-size"><a
href="<?= the_permalink(); ?>"><?php the_title(); ?></a></h3>
<div class="np-post-meta">
<?php news_portal_posted_on(); ?>
<?php news_portal_post_comment(); ?>
</div>
</div>
</div>
<?php } ?>
</div>
</div>
<? endif; ?>
</div>
<div class="middle-primary">
<?php dynamic_sidebar(\'np_home_middle_section_area\'); ?>
</div>
</div><!-- .np-home-middle-section -->
<div class="middle-aside">
<h2 class="np-block-title">
<span class="np-title">Новини Вінниці</span>
</h2>
<?php
$query = new WP_Query(
array(
\'post_status\' => \'publish\',
\'orderby\' => \'date\',
\'post_type\' => \'post\',
\'posts_per_page\' => 40,
\'category_name\' => \'vinnytsia\'
)
);
$day = \'\';
while ($query->have_posts()) : $query->the_post();
if ($day != get_the_date()) {
echo "<div class=\'date_separator\'><time>" . get_the_date(\'j F\') . "</time></div>";
$day = get_the_date();
}
$post_class = \'\';
$categories_list = array();
foreach (get_the_category() as $categories) {
$categories_list[] = \' \' . $categories->slug;
}
foreach ($categories_list as $slug_class) {
$post_class .= $slug_class;
}
?>
<h4 class="pt-cv-title <?= $post_class ?>"><span class="entry-date"><time><?= the_time(\'G:i\'); ?></time></span>
<a class="_self" href="<?= the_permalink(); ?>">
<?php echo the_title();
if (get_the_category()[0]->slug === \'video\'): ?> <span class="video"></span> <?php endif; ?>
</a>
</h4>
<?php endwhile; ?>
<a class="link_to_category" href="/archives/category/vinnytsia">Всі новини</a>
</div><!-- .middle-aside -->
</div>
<?php
/*-----------------------------------------------------------------------------------------------------------------------*/
/**
* Home middle fullwidth Section Area
*
* @since 1.0.0
*/
if (is_active_sidebar(\'np_home_middle_fullwidth_area\')) {
?>
<div class="np-home-middle-fullwidth-section">
<?php dynamic_sidebar(\'np_home_middle_fullwidth_area\'); ?>
</div><!-- .np-home-bottom-section -->
<?php
}
/*-----------------------------------------------------------------------------------------------------------------------*/
/**
* Home middle fullwidth Section Area
*
* @since 1.0.0
*/
$video_title = get_field(\'video_block_title\', 1620);
$video_posts = get_field(\'top_video\', 1620);
?>
<div class="middle-primary">
<?php if (!empty($video_posts) && $video_title): ?>
<div class="np-home-top-section np-clearfix">
<h2 class="np-block-title">
<a href="<?= get_category_link(get_category_by_slug(\'video\')->term_id); ?>"><?= $video_title; ?></a>
</h2>
<div class="video_block">
<div class="post_item top_item d-flex">
<div class="description">
<h3 class="post-title large-size">
<a href="<?= get_the_permalink($video_posts); ?>"><?= get_the_title($video_posts); ?></a>
</h3>
<div class="np-post-meta">
<?php
foreach ($video_posts as $key => $post) {
news_portal_posted_on();
news_portal_post_comment();
break;
}
?>
</div>
</div>
<div class="np-slide-thumb">
<a href="<?= get_the_permalink($video_posts); ?>">
<?= get_the_post_thumbnail($video_posts) ?>
</a>
</div>
</div>
<div class="video_list">
<?php
$args = array(
\'numberposts\' => 10,
\'category\' => get_category_by_slug(\'video\')->term_id,
\'orderby\' => \'date\',
\'order\' => \'DESC\',
\'post_type\' => \'post\',
\'suppress_filters\' => true
);
$video_news = get_posts($args);
foreach ($video_news as $key => $video) { ?>
<div class="video_item">
<div class="np-slide-thumb">
<a href="<?php the_permalink(); ?>">
<?= get_the_post_thumbnail($video) ?>
</a>
</div>
<h6 class="post-title large-size">
<a href="<?= get_permalink($video); ?>"><?= get_the_title($video); ?></a>
</h6>
</div>
<?php } ?>
</div>
</div>
</div>
<? endif; ?>
</div>
<?php
/*-----------------------------------------------------------------------------------------------------------------------*/
/**
* Home Bottom Section Area
*
* @since 1.0.0
*/
if (is_active_sidebar(\'np_home_bottom_section_area\')) {
?>
<div class="np-home-bottom-section np-clearfix">
<div class="bottom-primary">
<?php dynamic_sidebar(\'np_home_bottom_section_area\'); ?>
</div><!-- .bottom-primary -->
<div class="bottom-aside">
<?php dynamic_sidebar(\'np_home_bottom_aside_area\'); ?>
</div><!-- .bottom-aside -->
</div><!-- .np-home-bottom-section -->
<?php
}
/*-----------------------------------------------------------------------------------------------------------------------*/
/**
* Home Bottom fullwidth Section Area
*
* @since 1.0.0
*/
if (is_active_sidebar(\'np_home_bottom_fullwidth_area\')) {
?>
<div class="np-home-bottom-fullwidth-section">
<?php dynamic_sidebar(\'np_home_bottom_fullwidth_area\'); ?>
</div><!-- .np-home-bottom-section -->
<?php
}
get_footer();
?>