Redirect when click on “response” in comment section

You could create an alternative comments template that is based off of the regular WordPress template, and create a link in place of the “respond” button that links to your custom post. Instead of calling <?php comments_template(); ?> Just call <?php comments_template(‘/custom-comments.php’); ?> Here’s the WordPress article for reference – https://codex.wordpress.org/Function_Reference/comments_template

How can the recipients and content for comment email notifications on a custom post type be changed?

I did it the long way, with help from a related WordPress.org support thread: add_action(‘comment_post’, ‘notify_author_of_reply’, 10, 2); function notify_author_of_reply($comment_id, $approved){ $comment = get_comment($comment_id); $post_id = $comment->comment_post_ID; $post = get_post($post_id); if($approved && (get_post_type( $post_id )==’ticket’)) { $supervisor = get_userdata( get_post_meta($post->ID, ‘assigned_by’, true) ); $operator = get_userdata( get_post_meta($post->ID, ‘assigned_to’, true) ); $client = get_userdata( $post->post_author ); … Read more

Count comment threads, not total comments in a post

You could try this, must be used in the loop: <?php // type = comment will only get “real” comments, no ping-/trackbacks $comments = get_comments(array(‘type’ => ‘comment’)); $threads = 0; foreach($comments as $comment) { // if the comment has no parent, it´s the first of a thread if($comment->parent == ”) { $threads++; } } switch($threads) … Read more

Commenting out unwated CSS/scripts in HTML with PHP

Install Query Monitor to show your scripts and styles (#qm-assets) – specifically the ID used to register the scripts/styles. Then hook wp_print_scripts and use wp_dequeue_script() to remove it before it outputs. /** * Dequeue the jQuery UI script. * * Hooked to the wp_print_scripts action, with a late priority (100), * so that it is … Read more

css hide all the comment reply links except the lowest nested comments

I believe the easiest way to do that will be with javascript. Something that will navigate at each comment list and show only last button. Something like: jQuery(document).ready( function($){ //Hide all buttons $(‘.comments li .reply-button’).hide(0); //Navigate through all comments $(‘.comments li’).each( function() { //Lets check if there is children comments in this one if (! … Read more

Declaring in variables [closed]

You need to call global $variable; before you can use the variable. Try the code below instead for that line. // setup your global scope here global $icon_var; // set the new value in global scope $icon_var = get_post_meta($menu_item->ID, ‘_menu_item_custom’, true); // then use the variable $menu_list .= “\t\t\t\t\t<li><a href=\”$url\”>$icon_var<span>$title</span></a></li>\n”; DYNAMIC GLOBAL VARIABLE NAME If … Read more