Created
February 15, 2021 23:22
-
-
Save twentyfortysix/2f29ab8d85eb81f3a5a46fdcaa66963f to your computer and use it in GitHub Desktop.
php, enclosure, timber, comments
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$args = array( | |
'status' => 'approve', | |
'number' => 30, | |
'order' => 'DESC' | |
); | |
$comments = get_comments($args); | |
$post_ids = array_map(function($key, $value) { | |
return $value->comment_post_ID; | |
}, array_keys($comments), $comments); | |
$pargs = [ | |
'post_type' => 'post', | |
'post__in' => array_unique($post_ids), | |
]; | |
$data['posts'] = Timber::get_posts($pargs); | |
Timber::render('comments-archive.twig', $data); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment