Created
February 8, 2019 11:42
-
-
Save mrkkr/a92f4a1a757e299f101a15e51986a209 to your computer and use it in GitHub Desktop.
Wordpress - display comments form selected post
This file contains 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('cat' => 'home','post_type' => 'post')); | |
$post_obj = new WP_Query($args); | |
while($post_obj->have_posts() ) : $post_obj->the_post(); | |
//display comments | |
$comments = get_comments(array( | |
'post_id' => $post->ID, | |
'number' => '2' )); | |
foreach($comments as $comment) { | |
//format comments | |
} | |
endwhile; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment