How do I restructure the comment HTML layout?
How do I restructure the comment HTML layout?
How do I restructure the comment HTML layout?
A little late, but you could also add the following to your theme’s functions.php file: /** Comment Form Function Defaults */ add_filter(‘comment_form_defaults’,’my_comment_defaults’); function my_comment_defaults($defaults) { global $user_identity, $id; if ( isset($post_id) ) $id = $post_id; else $post_id = $id; $commenter = wp_get_current_commenter(); $req = get_option( ‘require_name_email’ ); $aria_req = ( $req ? ” aria-required=’true'” : … Read more
You could try to add your own custom get_comment_link filter just before you call the wp_list_comments() function: // Modify comment links add_filter( ‘get_comment_link’, ‘wpse_comment_link’, 10, 4 ); // Display comments wp_list_comments( $args, $comments); where our callback is defined as: function wpse_comment_link( $link, $comment, $args, $cpage ) { // Only run it once remove_filter( current_filter(), __FUNCTION__ … Read more
I’m not sure I fully understand your question, but to add some HTML (just over or under the submit field) that is visible to both logged-in and logged-out users, you can try the following: add_filter( ‘comment_form_submit_field’, function( $submit_field ) { //———————————– // Adjust the prepend to your needs //———————————– $prepend = ‘<p> Prepend some HTML … Read more
Take a look at rendering a comment_form. You can render it anywhere in your page template and there are lots of ways to customize it. $comments_args = array ( // change the title of send button ‘label_submit’ => ‘Send’, // change the title of the reply section ‘title_reply’ => ‘Leave Your Comment’, // remove “Text … Read more
Helper function Here’s a helper function (untested) to check if a given user ID is the first commenter for a given post ID: /** * Check if a given user ID is the first commenter for a given post ID * * @param int $user_id User ID * @param int $post_id Post ID * @return … Read more
You will need get_comment_meta to pull that information from the database. You will need to know the metakey. If you don’t have that, you will have to search the theme/plugin that generates the metadata for the occurence of add_comment_meta to find it. Where to hook depends on how your theme is listing the comments. If … Read more
I had the same problem and it was indeed solved by turning on Auto_Increment (A_I) for “comment_ID”. Here’s how to do that: https://stackoverflow.com/questions/5665571/auto-increment-in-phpmyadmin In my case, “comment_ID” was not set as a Primary Key and I received an error (1075). It was easily fixed by assigning a Primary Key to “comment_ID”. See this: https://stackoverflow.com/questions/19198397/mysql-how-to-set-the-primary-key-on-phpmyadmin
@JacobPeattie Forget my last answers. You are absolutely right, Antispam Bee was the cause. I didn’t install it on the second site. After installing it, I also have there now an obfuscated name. Thanks so much for your help! I should have seen this myself. Thanks for the great support here – with your help … Read more
You can use the pre_get_comments filter to modify the parameters of the comment query before it fetches the comments. Specifically the author_in parameter. I tried to write an example, though I haven’t tested it, but it would be similar to this: add_action( ‘pre_get_comments’, ‘author_and_self_comment_filter’ ); function author_and_self_filter( \WP_Comment_Query $query ) : void { // We … Read more