He's fighting the PKK for his own personal grudges against them but he is supporting the Peshmerga against ISIS:
http://aa.com.tr/en/turkey/turkish-military-reveals-peshmerga-training-details/486009
You may disagree with ISIS, but I challenge you to say that they're disbelievers. So what Erdogan is doing is standing by the side of non-muslim, the nationalist kurds and others against muslims, which confirms what I said. Erdogan messed up, he got an opportunity after opportunity and he still failed to act in the favor of the muslims in this war. But rather you will always find him prepared to stay on the side of the enemies of Islam. An exception to that rule is of course when he doesn't have to compromise a dime, so that he can win the support of gullible muslims in Turkey. That's the only time he feels that supporting the muslims pays of, and that's what is keeping him in power. Other than that he's no different from Kemal Ataturk, at least Kemal wasn't a hypocrite.
Here is some more (taken from the article above):
He's also supporting the shia, whom it is in their religious beliefs to kill muslims and rape muslim women. They have carried out these crimes, which undoubtedly they will be paying a full price for inshallah. But for our own sakes we have to recognize who our enemies are. And Erdogan is a very important player in all of this, and to not see him for what he is would be for us a grave mistake.
By the way, don't get me wrong. I never said it was in the interest of the muslims of Turkey to attack muslims in Syria, or in Iraq for that matter. What I am saying though is that Erdogan is a tyrant who is doing so, and he is by no means deserving of the support of any muslims.