Customizing comments pagination for bootstrap

Just replace that snippet for this one: <?php $pages = paginate_comments_links([‘echo’ => false, ‘type’ => ‘array’]); if( is_array( $pages ) ) { $output=””; foreach ($pages as $page) { $page = “\n<li>$page</li>\n”; if (strpos($page, ‘ current’) !== false) $page = str_replace([‘ current’, ‘<li>’], [”, ‘<li class=”active”>’], $page); $output .= $page; } ?> <nav aria-label=”Comment navigation”> <ul … Read more

WordPress Comments are automatically publishing

An administrator is normal the highest level of user in WordPress. If you want to approve every comments, even administrator comments, maybe you can use the moderation filter. If you go to Settings > Discussion Settings > Comment Moderation. You could setup an “cache all” filter. If you put all letters of the alphabet and … Read more

Create comments.php form of custom HTML code

The comment_form() function is pretty customizable, and it accepts a variety of arguments. Take a look at these sample arguments, you can modify them to fit your needs: $fields = array( ‘author’ => ‘<input name=”author” type=”text” value=”‘ . esc_attr( $commenter[‘comment_author’] ) .'” size=”30″ placeholder=”‘.__(‘Your name’,’text-domain’).( $req ? ‘ (Required)’ : ” ).'”/>’, ’email’ => ‘<input … Read more

Change the HTML of the comment form that is generating somewhere from the core WordPress

You can write your own custom HTML structure for comment listing. Inside your comments.php file, there will be a call to wp_list_comments() function. Find it, and pass your own function as its callback: wp_list_comments( array( ‘callback’ => ‘my_function’ ) ); Now, create a callback function and start implementing your own HTML structure. This function accepts … Read more

Auto delete comment if Contains

It is better to use ‘comment_post’ action for this purpose, it is fired when the comment is saved in database: add_action(‘comment_post’, ‘my_comment_post_callback’, 10, 3); function my_comment_post_callback($comment_id, $comment_approved, $commentdata) { if (strpos($commentdata[‘comment_content’], ‘dog’) !== false) { $post_url = get_permalink($commentdata[‘comment_post_ID’]); wp_delete_comment($comment_id, true); wp_redirect($post_url); exit; } }

How unrequire comment text in wordpress post

I solve it: step 1 – insert a random number in text body, because WordPress prevent users that duplicate comments. step 2- set display:none to textarea of comment field Finally copy this code in functions.php: add_filter( ‘comment_form_field_comment’, ‘set_default_comment_text’, 10, 1 ); function set_default_comment_text() { $post_id = get_the_title(); global $current_user; get_currentuserinfo(); $comment_rand = rand(10,100000); $comment_field = … Read more

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