Make use of the get_comment_link function in your foreach loop like so:
foreach ($comments as $comment) {
$output .= '<li><strong>'
. $comment->comment_author
. ' said</strong> : "'
. '<a href="'
. get_comment_link( $comment->comment_post_ID )
. '">'
. strip_tags($comment->com_excerpt)
. '..."</a></li>';
}
Related Posts:
- Difference between the_permalink() and get_permalink() function
- Use author author display name in permalink structure for pages and posts
- paginate_links() don’t properly work in search.php?
- Remove Comments Metabox but still allow comments
- Refresh page after form action
- How can I remove the title “leave a reply” in the comment box in twentyeleven?
- change the comment time output to: X time ago instead of actual date and time
- How to get comments with mixed status using get_comments?
- How to prevent deleting of comments when deleting a post
- Convert hyphen to underscore in permalinks
- disable comments if array exists
- Remove “says” from comments
- Display the number of user comments
- Adjust which tempalte a page uses with a function?
- Generate permalinks
- Comments to only be seen by their author
- How to Add a Random Custom Gravatar in the WordPress Comments?
- Disable shortlinks like ?p=1234 to prevent scraping
- Show top commenters without using a plugin
- Manipulate Permalink
- Change the HTML of the comment form that is generating somewhere from the core WordPress
- Commenter should see only his comments in wordpress
- Filter out other users comments. Visualize only own comments and editor role users’ comments
- wp-comment author- url +, email filter hook
- How to get correct URLs in network wide menu (Multisite)?
- paginate_links() don’t properly work in search.php?
- Incorrect redirect after commenting
- comments_popup_link without echo?
- Getting comment count per post not working
- Wp admin – Set default value to 999 in comments
- What is the Difference in bones_comments() and comments.php
- How to fix get_the_category function returning incorrect slug?
- Test if a post exists by category and date
- How to properly refresh page after form action?
- Setting Permalinks in wp_config or functions file?
- Function to replace comment’s accented characters before posting
- Redirect to post after publish or update a published post
- WordPress comment_form() does not display actual comments
- WordPress comment processing . Default unapproved comments detection before posting
- How do I change where “You must be logged in to comment” directs users?
- How to add extra value to permalink
- How do I make the comment disappear after deleting from the database?
- How Can I Create a Friendly Slug for a Dynamic Page?
- Add #primary at the end of navlink permalinks on single posts
- Remove nofollow from internal comment links via functions.php
- How can I automatically delete comments that contain a URL?
- Warning and fatal error
- Comment function for page
- How to identify author in wordpress comments?
- Filter posts on new page
- How can I return the result of my custom function?
- Newest comments first not working
- get_comments not working properly after WordPress v4.4 update
- Getting error while trying to use custom comment function
- Check if excerpt is empty at loop-portfolio
- Increase Comment Author Gravatar Size On WordPress Default Comment Function
- Exclude javascript in certain page url and all following url’s after forward slash
- Custom Nested WordPress Comments with avatar
- Undo a function that is not (seemingly) hooked to an action?
- Comment Function
- WP Custom Comment Callback Not Responding
- How to remove “login to reply” from individual comments [duplicate]
- Getting full code of wp_list_comments instead of replacing it
- Comment turned Invisible
- User’s Comments Number: Storing it in a meta field for different uses
- Add functionality to block comment authors in the Comment edit pag
- comments_template() doesn’t work with ajax call
- How to use: WP_AJAX_GET_COMMENTS
- WP backend, Show only own comments (give to users who wrote/published/assigned) posts
- How to manually activate user in dashboard only by admin
- In WooCommerce I need to modify the thankyou.php page [closed]
- When is wp_trim_excerpt() called?
- How do you completely remove the default header and footer using functions.php?
- Allowing SVG uploads in media uploader without plug-in
- Load JS Script only for custom post types
- WordPress upload_mimes not working for front-end uploads of 3D files
- Removing permalink from post thumb in twentyeleven
- Product object returns no sale price
- Option Tree integration of Custom CSS
- Can’t call Javascript function – scope?
- Deprecated function get_user_by_email($email)
- header_image() with CSS
- Shortcode parse error – wrong syntax
- Run a jquery script on on a certain template page
- Can’t add_action to ‘save_post’ and get it to fire
- How to load jQuery in TOP of wp_footer?
- How to fetch custom post type by variable date?
- two search forms on the same page
- Getting out side of wp root folder from function.php using absolute path
- Strange error from functions.php files (wp_register_script)
- How to setup a popup registeration page in wordpress with function.php
- How to update an image attachment’s alt text from a custom field when saving a post?
- Allow user only create specific tags
- How to display different blocks for mobile and desktops
- WP Enqueue Script Error
- Enqueue JS + CSS via a child theme functions.php file?
- How to add number to wordpress count function?
- Functions file mods and CPU
- How to display milliseconds instead of seconds using timer_stop function? [closed]
- No src and sizes attributes present on WordPress thumbnail images; the smallest image size is loaded irregardless of viewport size