Make wordpress comments work with include templatepath

Short answer: you can’t. Longer answer: You can include comments.php as a template-part file inside another template, via: get_template_part( ‘comments.php’ ) …but that won’t actually make comments work, because the comments_template() template tag does far more than merely include the comments.php template-part file. In order to make comments actually work when using get_template_part() as opposed … Read more

Show only if x comments?

wp_count_comments() returns the number of comments either for the whole blog or just for the current post. Example: if ( 10 < wp_count_comments( get_the_ID() )->approved ) echo ‘Wow, more than 10 comments!’;

Why are authors allowed to approve comments on their posts? How to revoke privilege?

The ability to set comment status is tied to the “edit_comment” capability, which is a meta-capability in WordPress. It maps to the “edit_post” capability, which is another meta-capability that varies depending on whether a post is published or not. In the end, if a post is published, then edit_comment ends up mapping to “edit_published_posts” for … Read more

default callback function in wp_list_comments

The wp_list_comments() function uses the HTML comment list class Walker_Comment by default: A single comment is then displayed with the Walker_Comment::comment() method (#source). If the comment format is HTML5 then the Walker_Comment::html5_comment() is used instead (#source). The pingbacks are rendered with the Walker_Comment::ping() method (#source).

Bots posting comments on pages

In order to add a new comment you really only need a couple of fields and a POST method. In a typical comment form, requests are submitted to http://www.example.com/wp-comments-post.php which parses the $_POST data and sends it off to wp_handle_comment_submission. A POST method varies from a GET request in that params are usually sent in … Read more

Adding ads code between comments

The end-callback of wp_list_comments() One way is to use the end-callback argument in: wp_list_comments( [ ‘end-callback’ => ‘wpse_comments_ads_injection’, … other arguments … ], $comments ); in addtion to your other wp_list_comments arguments, by defining: function wpse_comments_ads_injection( $comment, $args, $depth ) { static $instance = 0; $tag = ( ‘div’ == $args[‘style’] ) ? ‘div’ : … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)