Answer the question
In order to leave comments, you need to log in
How to correctly display posts for the current Monday from a specific category?
Hello.
It is necessary to display posts for the current Monday from a certain category (for example = 4 )
<?php
$params = array(
'date_query' => array(array('dayofweek' => 2)),);
$week = date('W');
$year = date('Y');
$the_query = new WP_Query( $params, 'year=' . $year . '&w=' . $week); ?>
<?php while ($the_query->have_posts() ) : $the_query->the_post(); ?>
Answer the question
In order to leave comments, you need to log in
The question is closed.
<?php
$week = date('W');
$year = date('Y');
$params = array(
'date_query' => array(array('dayofweek' => 2)),
'cat'=> '4',
'year'=> $year,
'w'=> $week,
);
$the_query = new WP_Query($params ); ?>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question