Adding custom text to bottom of all posts in particular category

If we want to add the same piece of custom text to the bottom of every post in a certain category of wordpress. How do then?
For example, we want to add “Good idea if you buy eyeglasses online!” at each page of category which category id is 2.

Try to add the following code in your theme’s functions.php:

Here is an example:, extra content under each page of category 2, Desiccant News.
At the same time, we do not let the extra content show under