Everyone starts out in programming as a specialist. You have to start somewhere and you can only learn one thing at a time. But once you get started, you will have to learn more to get anything done.
There are some people that specialize in a platform like Wordpress or Drupal. Platforms like these can be a good place to specialize when you start out. You will find plenty Wordpress or Drupal jobs out there. But because of that, you may also run into more competition for the job.
Being a specialist may come with it’s perks. You may jump to the top of list if you are the only developer who specializes in a specific platform. You may be able to tease out some magic that a developer unfamiliar with the platform won’t be able to pull off.
But to tell you the truth, I have run into very few pure specialists in this industry. At some point in you career, employers will trust you to be “smart”. If you can figure out one thing in code, it will be assumed that you can figure out similar things even if they aren’t in your wheelhouse currently.
So there isn’t even an argument here. Don’t decide whether you are going to be a generalist or specialist. You don’t have to. Be a generalist in general and a specialist when you are working.
When you are working on a specific platform or learning a new technology, be the specialist. Learn everything you can about it with the time you have. Try to become an expert at it even though you most likely will not be the best at it and even if you won’t touch next month. Don’t treat it like something you don’t have to be good at because it is not what you normally do. Always do the best work you can.
And when something else comes up. Do the same thing again. You won’t waste your time learning new things. All technology steals from its neighbor. So many of the things you learn from one technology will apply to the next. Some things won’t. And you will learn from that too.
You will become known as a developer who can “figure things out” no matter what comes your way. People will remember and you will get a reputation for getting things done even when you have no clue what you are dealing with at the outset. So my suggestion is to be both and become a one-man A-Team programmer.