How to add attributes to the comment form tag?
Use this function rather than comment_form() function validate_comment_form(){ ob_start(); comment_form(); echo str_replace(‘<form’,'<form attribute=”value” ‘,ob_get_clean()); }
Use this function rather than comment_form() function validate_comment_form(){ ob_start(); comment_form(); echo str_replace(‘<form’,'<form attribute=”value” ‘,ob_get_clean()); }
You can change the preference from settings. Navigate to Settings > Discussion page on your wp-admin Find Automatically close comments on articles older than and uncheck that option. That should solve your problem.
Actually it’s there within WordPress by Default. If your WordPress editor is not showing it, then from the top left corner, click the Screen Options drop down menu. It’ll show some check boxes. Among those, there is one called Discussion. If you check that, then WordPress will show the option Allow Comments after the editor … Read more
If in the root of the folder of your theme there is no file “comments.php”. Than comments_template () include the file from the path “/wp-includes/theme-compat/comments.php”. To make changes in that file you can copy “comments.php” from this folder to the root of your theme. And then change as you like.
This option is used to output a pingback comment. It’s passed to the Walker_Comment class, and if it’s set to true, it will output something similar to this: <li> <div class=”comment-body”> Pingback: <a href=”https://wordpress.stackexchange.com/questions/348102/author-url-here” rel=”external nofollow” class=”url”>Author Name</a> </div> The author URL is the field that users enter when filling out the comment form. Note … Read more
wp_get_current_commenter() returns an array, the entry ‘comment_author’ stores the name: Array ( [‘comment_author’] => ‘Harriet Smith, [‘comment_author_email’] => ‘hsmith@,example.com’, [‘comment_author_url’] => ‘http://example.com/’ ) More information is available in the codex. Update To find the nice name, ask the DB: /** * Searches the user table by display name. * @param string $display_name * @return object … Read more
Use $comment->comment_post_ID instead of $comment->post_id. Also you don’t need get_post(…). Just use get_the_title instead of your $post_obj and related code…
use the follow var: $comment->comment_approved and check for the value <?php if (0 == $comment->comment_approved) { ?> <em><?php _e(‘Your comment must approved.’, FB_BASIS_TEXTDOMAIN) ?></em> <?php } ?> code example: http://code.google.com/p/wp-basis-theme/source/browse/trunk/basis/comments.php
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
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!’;