Thanks to some wonderful help here at stack exchange, I have built a comment section with a dropdown menu that adds comment_meta to the comments. I currently have a working filter that uses GET to trigger an if statement to query based on this comment_meta info. The thing I don't like is that it refreshes the page each time you click a button. I'm looking for a way to filter without having the page refresh. I think I need Javascript …
I created a custom comments_list() function, it works fine, the only problem is to show child comments inside the parent div. It works well with first and second depth levels but not for others. This is my code: /* ----------------------------------------------------------------------------- * Comments custom functions * -------------------------------------------------------------------------- */ //Custom comments lst function t_one_comments_list( $comment, $args, $depth ) { $GLOBALS['comment'] = $comment; switch( $comment->comment_type ) : case 'pingback' : case 'trackback' : ?> <li <?php comment_class(); ?> id="comment<?php comment_ID(); ?>"> <div class="back-link"><?php …
I'm trying to add a button to my comments that allows a user to delete them. I have a form declared like so: <form method="post"> <input type="submit" name="btn-delete" value="try-delete"> </form> and above it the following php: <?php if (isset($_POST["btn-delete"])) { wp_delete_comment(get_comment_ID(), true); } ?> Note this is in my comments.php, and I use the standard API for looping through the comments. When I click on the button (from the input tag), it reloads the page and does nothing. If I …
I'm editing my comments.php, and within it I've added a reply button like this: <div class="reply"> <a rel="nofollow" class="comment-reply-link" href=<?php comment_reply_link(array('reply_text' => 'Reply this comment'), comment_ID()); ?> data-commentid="3" data-postid="487" data-belowelement="div-comment-3" data-respondelement="respond" data-replyto="Reply to admin" aria-label="Reply to admin"> Reply </a> </div> When I click on the "reply" button under any comment, the comment form pops up beneath the first comment, and only replies to the first one, rather than the one I clicked on. Can anyone explain the errors in this …
i'm making a custom Wordpress template and I've made this HTML code for single comment template: <div class="comment" id="1"> <div class="useravatar" style="background-image: url('[LINK]')"></div> <div class="textbox"> <div class="dateauthor">[AUTHOR NAME] <span class="date">[DATE]</span></div> <div class="text"> [COMMENT TEXT] </div> </div> </div> But i'm getting only headache to find out how to make a loop o something else where I can use this. Is there any good example for this cases?
EDIT: Yay, solved it! I needed to use new WP_Comment_Query( $args ) and set my $args to only include the current post and the meta chosen. Thanks! Thanks to the wonderful help of the community here, I have created a dropdown menu above my comments section to choose between BUY | SELL | TRADE | TALK. EDIT: I've changed my comment.php file. It now filters by comment_meta - YAY! Except, it gets ALL comments with this meta value. How do …
In my comments.php, I loop through the comments like this: if (have_comments()) : ?> <ol class="post-comments"> <?php wp_list_comments(array( 'style' => 'ol', 'short_ping' => true, 'callback' => 'better_comments' )); ?> </ol> <?php endif; where better_comments() is defined as follows: function better_comments($comment, $args, $depth) { ?> <li class="comment byuser comment-author-admin bypostauthor even thread-even depth-1"> <div class="comment-body"> <p>hello</p> <p> <?php comment_reply_link(array_merge($args, array('depth' => $depth, 'max_depth' => $args['max_depth']))) ?> </p> </div> </li> <?php } The comment_reply_link call gives me a reply button on my …
I'm trying to display the total number of comments for a users posts limited to a comment meta. I've tried using both get_comments() and WP_Comment_Query() but I get the same result of "1" for the comment count when it should be "3". Now in this example I can remove 'Count' => true and just loop through the comments and that will return the correct amount of comments in a loop but the count still equals one. They provide an example …
I manage a small site that has a very active comment area. The site is on shared hosting. There is a daily post entry, then a robust comment area. It is not untypical to have more than 100 comments on a day's post. The result is that loading or refreshing the current day's page is very slow - up to or more than 30 seconds. Sometimes a page load will time out with a 500 error. Other times a comment …
i have two websites i use Wordpress comments on one website and jetpack comments on another. Both websites shows website column, how do i remove it to save my site from giving unwanted backlinks ?
Is there a similar replacement of the hook posts_where for comments (WP_Comment_Query)? I need to modify the where clause for a comments query like it is shown in this tutorial (“4. Sub custom field values”) for posts. The only hook I found is comments_pre_query, but the property $query->meta_query_clauses[ 'where' ] is protected.
Hello I have multi author website. I want to display all comments of posts created by author in author page. Please help me. I found this code but fatal error <?php $args = array( 'author' => AUTHOR_ID, 'posts_per_page' => 500, //Don't use -1 here ); $the_query = new WP_Query( $args ); if($the_query->have_posts() ) : ?> <?php while ( $the_query->have_posts() ) : ?> <?php $nested_args = array( 'post_id' => get_the_ID() ); $comments_query = new WP_Comment_Query; $comments = $comments_query->query( $nested_args ); if …
I am getting the following error from comment-reply.min.js (which seems to be a WordPress file): Uncaught TypeError: Cannot read property 'firstChild' of null at comment-reply.min.js?ver=026d5828124b6319675d89d24f212b97:2 at Object.moveForm (comment-reply.min.js?ver=026d5828124b6319675d89d24f212b97:2) at HTMLAnchorElement.a (comment-reply.min.js?ver=026d5828124b6319675d89d24f212b97:2) Is this a known issue after upgrading to WordPress 5.5 or should I start debugging it? What would be the best way to address it? We have not changed the comments template but only upgraded to the latest version of WordPress. The relevant part of the template is: <?php …
I want to display images under for each comment but images store in database as serialized a:3:{i:0;i:775;i:1;i:776;i:2;i:777;} I wrote this code print_r (get_comment_meta( $comment->comment_ID , 'reviews-images', true )); but it outputs this * Array ( [0] => 778 [1] => 779 [2] => 780 [3] => 781 [4] => 782 ) 10 then I tried this echo get_comment_meta( $comment->comment_ID, 'reviews-images', true ); not worked . Please help how can I get image urls instead of this output
I have comments enabled on my site but the form isn't appearing. It worked at one point as there are comments on some of my posts with links to them but they don't appear on the page. Take this post: https://arcath.net/2016/03/react/ The theme is clearly showing 1 comment at the top of the page. Comments are enabled in Settings -> Discussion I've read a lot of forum posts on the subject that lead me to these settings but I can't …
As told in the title, I am looking for a way to prevent users to delete comments from the trash. Only admins should be able to. I tested the scripts at: Function to prevent users from trashing comments But it doesn't work, probably since 2013 a few things have changed :) Thank you for help!
I have a WordPress comment form, with a custom field (added with the Advanced Custom Field plugin) where the visitor can chose from a options (these are page IDs). When submitting the form, I want this select value to replace the comment_post_ID that by default adds the current page ID. What I'm trying to achieve is having a global comment form on just one page and then for the visitor to select a page (in our case, these are medical …
I use Wordpress commment pagination as follows: paginated comments comments displayed with the newest comments at the top of each page 50 comments on each page first page displayed by default The problem is that I am trying to achieve YouTube like comments such as - newest comments on first page, first page being displayed by default, then older comments in order on page 2, 3 etc The problem is that Wordpress comments are structured in such way,that I cannot …
I am creating a listing website on which i want to notify post author on new comment and notify users on reply of their comment . I want notification on profile page .How I do this? Any help? Thanks in advance