Last most recent post from set categories in tagdiv composer

Posted in: Newspaper
Post count: 101

Hi

I am currently trying to add a custom query in the data source.php file.

One can select in the composer the different categories from which to display posts.
( I set the post limit to four and four categories, “434, 19, 21, 38, 11” ).
What I am trying to achieve is that the query gets the single last most recent post from the four categories that I set in the composer. So I get to see 4 blocks, and they should each be from a different category.

I came this far but currently it is not working. Any thoughts on how to achieve this ?

            case 'one_from_each':  
                $wp_query_args['date_query'] = array(
    												'cat' => $category->term_id,
    												'post_type' => 'post',
    												'posts_per_page' => '1',
    												'post__not_in' => $do_not_duplicate
								);
                $wp_query_args['order'] = 'DESC';
                break;   
Post count: 20688

Hi,

I have no idea how to do something like that unfortunately, sorry. If you want the latest posts from four different categories use four different blocks filtered by them and sorted by latest.

Viewing 2 posts - 1 through 2 (of 2 total)
The forum ‘Newspaper’ is closed to new topics and replies.