Site logo

Archived topic

How to Highlight Contributor and Administrator Comment in Posts

24 replies · Started by Ravi Saive on December 27, 2022

Viewing posts 16–25 of 25

Alright. I understand.

In any case, this shouldn't be a theme-related issue. There's no code in GeneratePress that should make the bypostauthor class not appear. GeneratePress theme uses the default WordPress comment template. As you can see here, if the Comment author is the Post author, a class bypostauthor should be added. https://github.com/WordPress/WordPress/blob/cf9793f0dfaf5a9565302690566007cf65389e8d/wp-includes/comment-template.php#:~:text=%24classes%5B%5D%20%3D%20%27bypostauthor%27%3B

Yours isn't adding that. I presumed it's caused by a plugin but since it isn't, it may be a PHP code or something else. You'll need to double-check if the comment author is indeed the post author. If it is, you'll need to disable everything external to find the cause of the issue. Starting from plugins to custom codes.

If you're using a Child theme, try using the parent theme as well to test. Make a new comment on every test to check.

It would be good to ask here as well: https://wordpress.org/support/forum/wp-advanced/

Hi Fernando,

I've managed to create a staging site for you to test out and fix the issue...

Any update?

It doesn't look like Fernando requested a staging site login.

This isn't a theme-related issue so it's not something we can help to debug.

Have you tried his debugging suggestions in the previous reply?
https://generatepress.com/forums/topic/how-to-highlight-contributor-and-administrator-comment-in-posts/page/2/#post-2475430

You would basically need to go through #1 here and if that doesn't work, try #4 in the same article:
https://docs.generatepress.com/article/debugging-tips/

@Leo,

Fernando asked me to give staging login details, see this comment - https://generatepress.com/forums/topic/how-to-highlight-contributor-and-administrator-comment-in-posts/#post-2475406

It is a theme-related issue might be because I am using the same theme on two sites and have the same problem on both sites. Also, I have not made any changes or modifications to the theme PHP files, I just added some custom CSS that too from the customizer section...

I have tried all the debugging suggestions, but no luck... Could you please help me out...

As mentioned by Leo, this shouldn't be a theme-related issue. It should be the default WordPress behavior. There's no code in GeneratePress that should cause this not to work or alter its behavior. This is actually the first time I've seen this issue on a GP site as well.

It may be good to raise a topic here instead: https://wordpress.org/support/forum/wp-advanced/

You can try using a different WordPress theme to confirm if it is indeed a theme-related issue. Check #4 here: https://docs.generatepress.com/article/debugging-tips/

@Fernando,

I managed to trace the issue, the problem is when a new article is created and published by the WP Admin user and then later assigned to the actual author via the Quick Edit --> Author tab - the bypostauthor tag is missing...

Whereas, if an author login to the WP dashboard and created a post, and publishes itself, then the bypostauthor tag is added automatically...

See the link in the private tab, where you can see the comments of the Author and Admin highlighted with a badge...

Now the question is, all my previous articles are created and published by the WP Admin account, and later assigned to the Author. Now how do I make the bypostauthor tag added to these previous published articles?

@Fernando,

I have created a topic at the WP forum as suggested by you, let's wait and see...

Alright! Hope there's a solution!

This archived topic is closed to new replies.