You're going to want to avoid trash talking who you divorced in front of your children. They already probably feel a connection with your ex that needs to be acknowledged. Instead of saying mean or even nice things about your ex, you need to just avoid talking about them in front of your kids so you don't confuse them or force them to pick a side to be on. If you talk a lot of trash on your ex then the kids are going to think about which parent they want to protect and they'll sometimes pick a side which isn't a good thing to have happen.
You may want to get your children into therapy, especially if this is happening to them at a time where they find it hard to understand what is going on. If you notice that your child is more depressed or has other mental issues like with anxiety, it may be due to the divorce and you're going to want to work with a therapist that can help them get through the process of the divorce. It can be hard for a child to get through this without any kind of help so be sure you get them help if they need it.
If you're not the parent that's going to keep the kids most of the time, make time to see your kids or at least contact them on a regular basis. If you just stop talking to them and go about your life as if you don't have children any longer, they are going to wonder what they did wrong or what is wrong with them. It's best to at least give your children a call regularly so you can have a chat with them about how they are doing and what's going on in their lives.
Children and divorce don't go well together. You can, however, use what you learned here to make the process go as well as it can. It's difficult to get through a divorce, especially if you have children, but it is possible for it not to be super messy.