How to create a classified section in place of comments_template

I am running a site where users can find great information about musical artists and their releases. Each release is a wordpress post. Each artist is a wordpress post. In my single-artist.php and my single-release.php, i use comments_template(); EDIT: here is my comments.php comment_form(); if (have_comments()) : $wantto= get_comment_meta( $comment_id, 'wantto', true ); echo '<ol class="post-comments">'; wp_list_comments(array( 'style' => 'ol', 'short_ping' => true, )); echo $wantto; echo '</ol>'; endif; It just shows a text box. Here's an example of a …
Category: Web

Passing arguments to wp_list_comments callback function

One can customize single comment markup using the callback argument in wp_list_comments like this: $args = array( 'callback' => 'my_callback', 'avatar_size' => 48, 'type' => 'comment' ); wp_list_comments( $args ); The question is, how to pass arguments to that my_callback function? Already it gets three: function my_callback( $comment, $args, $depth ) But I need to add my own 4th argument
Category: Web

How to make comments private for commentor and post author

I am trying to make comments private. I mean comment must be visible for post author and comment author. I create custom comment section "better-comment.php". I have used pre_get_comments but I can not make work. Please help <?php // My custom comments output html function better_comments( $comment, $args, $depth ) { // Get correct tag used for the comments if ( 'div' === $args['style'] ) { $tag = 'div'; $add_below = 'comment'; } else { $tag = 'li'; $add_below = …
Category: Web

Comment Walker vs. Comment Callback

I've been messing around with custom comments this week and I'm trying to figure out when I'd want to use a walker and when I'd use a callback... There's some things I can't quite figure out how to change, but the one that's been driving me mad is how to add classes to the children <ul> tag: <ul class="children"> Are there certain things a comment walker can do that a comment callback can't?... or vice-versa? And is one of these …
Category: Web

Name of comment field differs on different sites

I have a question regarding the „name“ of the comment field of wordpress blogs. I have 2 sites, that are just available locally on my LAN. On the first site, if I inspect the comment field in firefox, I see: <textarea id="comment" name="comment" cols="45" rows="8" maxlength="65525" required="required"></textarea> On the second site I see: <textarea autocomplete="new-password" id="comment" name="i817ab2c85" cols="45" rows="8" maxlength="65525" required="required" spellcheck="false"></textarea> Can anybody tell me, why the name of the comment field differs on the second site? Both sites …
Category: Web

How do I make the comment disappear after deleting from the database?

I can delete the comment from the database with this code, however when the page is loaded again the comment will still be there. I need to update again to disappear. How do I resolve this? <?php if( 'POST' == $_SERVER['REQUEST_METHOD'] ) { set_query_var( 'commentid1', $_POST['commentid'] ); wp_delete_comment( get_query_var( 'commentid1'), true ); }; ?> <form class="delete-comment" action="" method="post"> <input type="hidden" name="commentid" value="<?php comment_ID() ?>" /> <p align="right"> <input type="submit" value="Delete" title="Delete" /> </p> </form>
Category: Web

Enable comments for custom template page

We use careerfy theme WordPress which is a system for a job board. I would like to enable comments for each job post page, these pages are not listed on the WordPress admin panel, I can access it via child theme only, in this path: (wp-content/themes/careerfy-child-theme/wp-jobsearch/detail-pages/job/view3-job.php) I have tried to add a shortcode but it seems not working.
Category: Web

How to put the author of the post in the comments?

I need to put the name of the author who wrote the post and I can't find the solution. EXAMPLE: Rachel [06/03/21] : Commented in the post "How to be a Web Designer", written by: POSTAGE AUTHOR - Test Comment <?php $args = array( 'user_id' => bp_current_user_id(), 'number' => 20, // how many comments to retrieve 'status' => 'approve' ); $comments = get_comments( $args ); if ( $comments ) { $output.= "<ul>\n"; foreach ( $comments as $c ) { $output.= …
Category: Web

How to display comments on different page

I am creating a reviews site and I want to display the customer reviews (comments) on a separate page from the single-restaurant.php. I'll just have a link that says (Read reviews/ add yours). I created a custom comments template and called it comments-side.php and this is what I have in it: <?php /** * Comments Template * */ ?> <div id="comments-template" class="comments-side"> <div class="comments-wrap"> <div id="comments"> <?php if ( have_comments() ) : ?> <?php do_atomic( 'before_comment_list' );// supreme_before_comment_list ?> <ol …
Category: Web

adding a text message beside the comment submit button

What is the cleanest way to display a text message beside the submit button like this in screen shot: I am currently doing it by editing the file wp-includes/comment-template line 1577 (wordpress 3.5) before: <input name="submit" type="submit" id="<?php echo esc_attr( $args['id_submit'] ); ?>" value="<?php echo esc_attr( $args['label_submit'] ); ?>" /> after: <input name="submit" type="submit" id="<?php echo esc_attr( $args['id_submit'] ); ?>" value="<?php echo esc_attr( $args['label_submit'] ); ?>" /> (your message will only be visible after moderation) I understand this is not …
Category: Web

How to add a privacy-checkbox in comment-template?

i need to add a privacy-checkbox to the file comment-template.php. I created the checkbox and a paragraph and it looks fine, so far. <input type="checkbox" name="privacy" value="privacy-key" class="privacyBox" aria-req="true"><p class="pprivacy">Hiermit akzeptiere ich die <a target="blank" href="http://wp.cloudstarter.de/?page_id=156">Datenschutzbedingungen</a><p> Now, i want to connect this checkbox with the submit-button, so that a user HAS to accept the privacy to comment on a post. Anyone with a clue how to do that? Or it there a plugin, which delivers this services?
Category: Web

customizing TwentyEleven comments template

Typically I don't utilize comments on my sites, however I'm using the comments functionality as a sort of live-feed testimonials page. To do this, I've borrowed comments.php and the comments portion of functions.php from the TwentyEleven theme. What I'm currently struggling with is how the comments/form are displaying on the site Ideally, I'd like the form to be on the left (inside .content-left) and the list of comments to be on the right (inside .content-right). Currently, the list of comments …
Category: Web

Customize Theme comment template to Insert VoteUp and VoteDown buttons

I am using a theme that has an okay comment template that I would not want to change. However I just want to insert voteup and votedown button directly below the User avartar <ul class="comment-list"> <?php wp_list_comments(array( 'style' => 'ul', 'short_ping' => true, 'avatar_size' => 70 )); ?> </ul> I saw a suggestion to add a callbackfunction that would create a new theme. Using this SO here. <?php wp_list_comments(array( 'style' => 'ul', 'short_ping' => true, 'avatar_size' => 70, 'callback' => …
Category: Web

Wordpress comments - how to check if comment still needs to be approved?

I created a comments.php template and which contains the following code: <div class="amb-single-comments amb-container-parent override"> <div class="amb-single-comments-container amb-container-child override"> <div class="amb-single-comments-wrapper-centered override"> <?php if ( post_password_required() ) { return; } ?> <?php if ( have_comments() ) : ?> <!-- Comments header --> <h3 class="amb-comments-title"><?php echo esc_html( get_theme_mod('amb_single_styleparts_comments_title', 'Comments') ); ?></h3> <!-- Comments list --> <ul class="amb-comments-list"> <?php wp_list_comments( [ 'reverse_top_level' => true, //Newest first 'callback' => 'amb_comments_output', 'per_page' => '200', 'max_depth' => 20 ] ); ?> </ul> <?php endif; ?> …
Category: Web

How to display replies to his comments in user profile of current user

How to display list of replies to his comments in user profile of current user. my website can send notification that example: "someone replied to your comment" and when i click the link that was sent by notification email it forward me to comment page. i also want to list these replies in user profile. thanks for attention
Category: Web

How to show a list of comments on home page from all posts?

I have a custom post type for games on my site (https://pokerdiy.com). I have comments on these games and now want to show a list of recent comments on the home page of my site (kind of like the Facebook wall) to show the activity that is going on. I am using Elementor and want to be able to style it. I tried to use the Posts Elementor block but this does not allow the selection of Comments. Any suggestions …
Category: Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.