Comments.php Yapıldı !

Comments.php Yapıldı !

//Get only the approved comments$args= array('status'=> 'approve');// The comment Query$comments_query= newWP_Comment_Query;$comments= $comments_query->query( $args);// Comment Loopif( $comments) {foreach( $commentsas$comment) {echo'<p>'. $comment->comment_content . '</p>';}} else{echo'No comments found.';}

The comments.php template contains all the logic needed to pull comments out of the database and display them in your theme.

Before we explore the template file you’ll want to know how to pull in the partial template file on the appropriate pages such as single.php. You’ll wrap the comment template tag in a conditional statement so comments.php is only pulled in if it makes sense to do.

1234// If comments are open or we have at least one comment, load up the comment template.if ( comments_open() || get_comments_number() ) :comments_template();endif;

Hakkında admin

Benzer Yazılar

3 Comments

John Doe

5 min ago

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.

Reply

John Doe

5 min ago

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.

Reply

John Doe

5 min ago

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.

Reply

Leave a reply