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

You can use the provided filters to do all that: //add your checkbox after the comment field add_filter( ‘comment_form_field_comment’, ‘my_comment_form_field_comment’ ); function my_comment_form_field_comment( $comment_field ) { return $comment_field.'<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>’; } //javascript validation add_action(‘wp_footer’,’valdate_privacy_comment_javascript’); function valdate_privacy_comment_javascript(){ if (is_single() && comments_open()){ wp_enqueue_script(‘jquery’); ?> <script type=”text/javascript”> jQuery(document).ready(function($){ … Read more

Warning: call_user_func_array() expects parameter 1 to be a valid callback, func

I’m pretty sure that function tnc-remove_default_menu is not defined anywhere in your code. (You shouldn’t use – character in function name in PHP). So most probably there is a function called tnc_remove_default_menu, and you’ve misspelled it’s name in add_action/add_filter. If there is no such function anywhere in your code, then you should remove this filter/action … Read more

On WordPress 4.4, how to get the post id using the comment_post hook

The third parameter, $commentdata can be used to get the ID for the post that the comment was made on: function wpse211367_comment( $comment_ID, $comment_approved, $commentdata ) { // The id for the post that the comment is related to is available // in the $commentdata array: $comment_post_id = $commentdata[‘comment_post_ID’]; } add_action( ‘comment_post’, ‘wpse211367_comment’, 10, 3 … Read more

WP comments form (custom) is displaying an extra comment field

It seems that WordPress handles the comment field separately than the other fields. If you look at comment_form() in wp-includes/comment-template.php, you can see this. It’s possible to set $defaults[‘comment_field’] to false in alpha_comments_defaults() then add the comment field markup to $fields[‘comment_field’] in alpha_comments_fields() in the desired order, but this could cause trouble with plugins. I’ve … Read more

How to remove the “on” string before recent comments link?

The source of the text in question lives in wp-includes/widgets/class-wp-widget-recent-comments.php I found it by searching the WP files for the id of the widget, recentcomments, which I gathered by inspecting the HTML of the widget. So, here’s where that on is coming from, with a bit of extra code for context: foreach ( (array) $comments … Read more

WP_Comment_Query with 5 top level comments per page?

Updated The hierarchical parameter controls whether to include comment descendants in the comments results. From the inline docs we have that it accepts the following values: ‘threaded’ returns a tree, with each comment’s children stored in a children property on the WP_Comment object. ‘flat’ returns a flat array of found comments plus their children. false … Read more

How to save new comment as custom comment type?

In addition. You already have code which can kind of do what you need. add_filter( ‘preprocess_comment’, ‘verify_comment_meta_data’ ); function verify_comment_meta_data( $commentdata ) { if ( ! isset( $_POST[‘wp_review_comment_rating’] ) ) wp_die( __( ‘A rating is required. Hit the BACK button and resubmit your review with a rating.’ ) ); // this is filter and $commentdata … Read more

Toggle nested comments

http://jsfiddle.net/K3gr7/4/ I used an ordered list to markup the comments. You probably need to tweak it to your own setup, and cache some variables for optimization, but the functionality is in there. $(document).ready(function() { // Toggle all $(‘#toggle-all’).click(function() { var $subcomments = $(‘#comments’).find(‘> li > ol’); if ($subcomments.filter(‘:hidden’).length) { $subcomments.slideDown(); } else { $subcomments.slideUp(); } … Read more

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