вот полный код функции подв5ажите как связать?
function get_mostpopular_posts($category_id, $limit, $view = 'in_column') {
$popular_articles = get_posts(
array(
'numberposts' => $limit,
'category' => $category_id,
'meta_key' => 'views',
// 'meta_key' => '_recommended_all', // don't delete
'orderby' => 'meta_value_num',
'order' => 'DESC',
'suppress_filters' => false
)
);
$date_mostpopular = array(
'date_query' => array(
array(
'dayofweek' => array( 1, 7 ), // дни недели, 1 - понедельник, 5 - пятница
'compare' => 'BETWEEN'
)
)
);
$dateq = new WP_Query( $date_mostpopular );
if ($view != 'in_line') {
foreach ($popular_articles as $article) {
?>
<a href="<?php echo get_the_permalink($article->ID); ?>" class="min-news-item"
title="<?php echo $article->post_title; ?>">
<div class="min-news-desc">
<div class="min-news-desc-text"><?php echo $article->post_title; ?></div>
<div class="item-news-info">
</div>
</div>
</a>
<?php
}
} else {
?>
<?php foreach($popular_articles as $article): ?>
<?php $category = get_the_category($article->ID); ?>
<a href="<?php echo get_the_permalink($article->ID)?>" class="min-news-item" title="<?php echo $article->post_title; ?>">
<div class="min-news-ico" style="background-image: url(<?php echo get_the_post_thumbnail_url($article->ID, array(89, 89)); ?>)"></div>
<div class="min-news-desc">
<?php if ($category_id == 0): ?>
<?php
$color = '#72bf44';
if (get_field('цвет', 'category_'.$category[0]->term_id)) {
$color = get_field('цвет', 'category_'.$category[0]->term_id);
} elseif ($category[0]->parent != 0) {
$color = get_field('цвет', 'category_'.$category[0]->parent);
}
?>
<span class="labal-news lable" style="background-color: <?php echo $color; ?>;"><?php echo $category[0]->name?></span>
<?php endif; ?>
<div class="min-news-desc-text"><?php echo $article->post_title; ?></div>
<div class="item-news-info">
<span href="" class="comments"><?php echo get_comments_number($article->ID); ?></span>
</div>
</div>
</a>
<?php endforeach; ?>
<?php
}
}
Как связать функкции?
$date_mostpopular = array(
'date_query' => array(
array(
'dayofweek' => array( 1, 7 ), // дни недели, 1 - понедельник, 5 - пятница
'compare' => 'BETWEEN'
)
)
);
$dateq = new WP_Query( $date_mostpopular );