I think it is safe to say that very few children enjoy every subject in school. How do you motivate your child to put effort into subjects that they just aren't interested in? I feel this is a separate issue than frustration stemming from doing poorly in a subject, and I suspect that the methods of addressing the issue are likely to be very different.
I think this question is a bit vague as the answer will vary by subject and age of the child.
Some are relatively easy to relate to things your child would be interested in, such as math or reading. For example, you can create math problems around sports for a child that is interested in the topic (batting average for percentages, scoring by inning for patterns, etc.). Books can be tailored to interests as well.
Others, like science or history, would be more difficult to come up with ways to make the subject more interesting. Textbooks often have some do-at-home exercises/experiments that you can do with your child.
My advice would be to teach them it's okay to not like every subject and simply try to instill a good work ethic. Explain that some things have to be done regardless of how fun they are and the long-term value of education. I think there is too much focus on trying to make everything fun*; plenty of tasks are chores and completing them is simply part of being a responsible person.
Now that it's been reframed as a necessary chore, how do you motivate children to do chores? Two of the most common ways are rewards for voluntary completion and punishment for resistance or neglecting their duties.
*too much in general; I don't see any flaw with your question.
I would personally start by finding out why they don't like it because that will help direct you. If you child gives the typical pat answer of "its boring" then go for the it is okay not to like everything answer, but finish it off with, "is there a way it could be less boring". Kids are pretty good at knowing what they want and what would help, they're just bad at expressing it. If your kid gives you a feasible answer to the question about how to make it less boring, see if you can help them enact something that addresses the answer you were given. Learning should be fun more often than not.
Then, if you can make a connection, use their interests to develop more interest in the things they don't like. For example, if your child really likes cinematography, have him or her do a documentary about the subject he or she finds boring. If he/she is really into music, ask your child to write the lyrics to a song about the subject in question. I have Alice act things out all the time. It makes it more interesting to her.