WordPress Custom Avatar in comments

I have built my own frontend user avatar upload script. Now the avatars show fine in the user section in admin and in the top panel. However I can’t seem to get them showing in the comments and author sections of the site.

I use the following get_avatar code

add_filter ('get_avatar', function($  avatar_html, $  id_or_email, $  size, $  default, $  alt) { $  avatar = get_user_meta($  id_or_email,'avatar',true); if( $  avatar ) {     return '<img src="'.$  avatar.'" width="96" height="96" alt="Avatar" class="img-fluid rounded-circle" id="wad_profile_avatar" />'; } else {     return $  avatar_html; } 

}, 10, 5);

Any ideas how I can get it to show in comments also?

I am unable to understand the logic behind the code (I’ve added exact queries as comments in the code)

Our local ninja Naruto is learning to make shadow-clones of himself and is facing a dilemma. He only has a limited amount of energy (e) to spare that he must entirely distribute among all of his clones. Moreover, each clone requires at least a certain amount of energy to function (m) . Your job is to count the number of different ways he can create shadow clones. Example:


ans = 4

The following possibilities occur: Make 1 clone with 7 energy

Make 2 clones with 2, 5 energy

Make 2 clones with 3, 4 energy

Make 3 clones with 2, 2, 3 energy.

Note: <2, 5> is the same as <5, 2>. Make sure the ways are not counted multiple times because of different ordering.


int count(int n, int k){     if((n<k)||(k<1)) return 0;     else if ((n==k)||(k==1)) return 1;     else return count(n-1,k-1)+ count(n-k,k);   // logic behind this? }  int main() {     int e,m;            // e is total energy and m is min energy per clone     scanf("%d %d", &e, &m);     int max_clones= e/m;     int i,ans=0;     for(i=1;i<=max_clones;i++){         int available = e - ((m-1)*i);   // why is it (m-1)*i instead of m*i         ans += count(available, i);     }     return 0; } 

Multiple blog comments to 1 url

I have a list of auto approve urls that have my link posted on it 1 time. And I would like to re-use the list to comment with the same links 1 more time.

But when i try and re-post the same link, i get the message “link already present”.

I checked the option, Options > Scheduled Posting >  “allow posting on same site again

But still no luck, has anyone got any ideas on how to enable this please?

Understanding lexical grammar for multi-line comments in JavaCC

I’m struggling to understand why this piece of lexical grammar works for multi-line comments in JavaCC (posted here):

 "/*" (~["*"])* "*" (~["*","/"] (~["*"])* "*" | "*")* "/" 

As I read it, the parser scans the input /*, and then zero or more optional occurrences of * can appear, followed by a *, and then zero or more optional occurrences of * and /, then zero or more occurrences of * followed by * or *, ended by a /. Specifically, this part boggles my mind:

 (~["*","/"] (~["*"])* "*" | "*")* 

I’d appreciate some help understanding this.

WP Comments with CSS Counters

I’d like to use CSS counters on WP comments, like this:

1 (first comment) 1.1 (reply 1) 1.2 (reply 2) 1.2.1 (first reply to 2) 1.2.2 (second reply to 2) 1.3 (reply 3)  2 (second comment) 2.1 (reply 1)... 

I’m struggling to understand how to set the counters, then reset the counters based on the nesting involved in WP comments. I’m using ::before to display the counters, which works fine…I just can’t get the numbering right. Can anybody help me understand the nesting, and how to do counters like 1.2.2?

Comments on my custom post type

I have a custom post type gig and added the supports Comments but it doesn’t show any comment input at all.

$  args = [     "label" => __( "Gigs", "understrap" ),     "labels" => $  labels,     "description" => "",     "public" => true,     "publicly_queryable" => true,     "show_ui" => true,     "delete_with_user" => false,     "show_in_rest" => true,     "rest_base" => "",     "rest_controller_class" => "WP_REST_Posts_Controller",     "has_archive" => false,     "show_in_menu" => true,     "show_in_nav_menus" => true,     "delete_with_user" => false,     "exclude_from_search" => false,     "capability_type" => "post",     "map_meta_cap" => true,     "hierarchical" => false,     "rewrite" => [ "slug" => "gig", "with_front" => true ],     "query_var" => true,     "supports" => [ "title", "editor", "thumbnail", "comments" ], ]; 

For testing purposes, I’ve only added the following php code in my template:

<?php     comments_template(); ?> 

This is the output:

<div class="comments-area" id="comments">  </div> 

Just an empty comments-area div.

What am I doing wrong over here? The comments work on the post type post.

Possible options of minimizing duplicate comments?

Are there any solutions that combine or group similar comments? Any plugins, 3rd parties or anything that takes community comments and compress what has been already said?

Barring that, what would it takes to create something that consolidate comments with the same messages (under youtube video or Reddit post, for example)?

Blog Comments – author name and format

Hi @Sven
I am wondering if I create custom blog comments, is it possible to add line breaks to comments?
And secondly, is there a way to refer to the FIRSTNAME or NAME of the post author? EG %First_name% or something like this?
It would be great to do both of these for Blog Comments.
Here’s an example comment that we could form if these were enabled/possible:

Multilingual Comments on my website

I have a website which contains description, title, cover of movie or some other things. On the bottom I have Facebook comments.

I have a 2 questions.

Should I change Facebook comments to Disqus comments?

Comments should be universal or separate for each language? (website Available in English, Armenian and Russian, should I separate comment block for single entity, let’s say movie or all users should see all comments about that movie and be able to discuss in different languages?)

Interface examples for handling “page notes” and highlighted text comments?

I’m working on a collections-based interface (think Pinterest or Dropbox), and we’re implementing a feature that allows users to add Notes/Comments to various elements (folders/boards, files/pages, highlighted text, etc…).

These “notes” would be accessible either via an icon (say, a small Post-It note with the total count), or a sliding tray somewhere (there could be multiple notes for a specific item). Additionally, they’ll need to access any notes they’ve added to specific text they’ve highlighted on a page. Should this be included in the standard Notes, or be treated differently? Not sure…

I’m having a hard time finding inspiration for this, and would love to see examples of Notes being handled really, really well.

Does anyone have any screenshots they could share of existing apps? Or any thoughts on how we should be handling this? I’m a bit stuck here and could use some inspiration 🙂

Thank you so much!