First find the wp_regiondes/default-widgets.php under the root directory, find in functionwidget '(about 625th lines)
Run the following code (about 655th lines ):
The code is as follows: |
Copy code |
If ($ comments ){ Foreach (array) $ comments as $ comment ){ $ Output. = '<li class = "recentcomments">'./* translators: comments widget: 1: comment Author, 2: post link */sprintf (_ x ('% 1 $ s on % 2 $ s', 'widgets'), get_comment_author_link (), '<A href = "'. esc_url (get_comment_link ($ comment-> comment_ID). '">'. get_the_title ($ Comment-> comment_post_ID). '</a>'). '</li> '; } } |
Set
The code is as follows: |
Copy code |
Change get_the_title ($ comment-> comment_post_ID) to strip_tags ($ comment- > Comment_content ), |
At the same time, change the on in sprintf to the text you want to display, such as "say", so that the style becomes
"Comments" say "comment content" Below is the modified code (note: back up the code before modification)
The code is as follows: |
Copy code |
If ($ comments ){ Foreach (array) $ comments as $ comment ){ $ Output. = '<li class = "recentcomments">'./* translators: comments widget: 1: comment Author, 2: post link */sprintf (_ x ('% 1 $ s said: % 2 $ s', 'widgets'), get_comment_author_link (), '<A href = "'. esc_url (get_comment_link ($ comment-> comment_ID). '">'. strip_tags ($ Comment-> comment_content). '</a>'). '</li> '; } } |
In fact, this $ output is the output html code, so you can modify it based on your own needs.