WordPress Themes - partly not under GPL?

if I did something cool I want to use with WordPress, could I publish this code not under GPL or any other free license (for example by mention an other license in the top code with comments) and maybe even sell it on Themeforest?

To clarify: This code would NOT interact in ANY way with WordPress Code. You could use this probably in any PHP program (so in PHP code I have a function with this code and then use this function in WordPress Hooks or whatever). The code itself returns only values, which I use to handle with WordPress. It’s not only PHP , also JS (at this point, it uses some jQuery and jQuery Plugins, but they’re all published under MIT license, too) and HTML and CSS and whatever

Best regards, indiapart.

PS.: Don’t think please, I’m a egoistic spastic and don’t want to share my code for free I want, I’m just about thinking in which way and where and got some other good reasons, why I would not want to share it. It’s not done by far anyway, too – it’s just an idea =)

Think of it this way: you create a kickass PHP library that can be used by itself or with any PHP framework. You can release this code under any license you choose, free (as in speech), free (as in beer), paid, anything. Now, you decide to include it in a WordPress theme. WordPress states in its license that any “derivative works” must inherit the same license that WordPress has, but it does not have the power to override the license of a separate work. Since your library can work on its own, and doesn’t contain any WordPress code, you could retain your license for that. Just use the WordPress hooks to call your library, and you’ll be in the clear. In fact, for the theme I’m working on, the way I’ve structured the code, there is practically nothing that would inherit the WordPress license because virtually all functionality is abstracted away from the WordPress code.

kstv_chttrj said
Can any one tell me in a very simple manner that what is MIT License / GPL License?
Does it means that you can use it for free and without restriction for commercial project?

The word “free” is ambiguous. Free software licenses like GPL mean that you are free (as in speech) to redistribute and modify the code, either for free (as in beer) or as a paid product, as long as you include the text of the license, and pass along the same rights to anyone who uses your code.

So if I write some code and license it under the GPL and post it on my website for anyone do download at no charge, you are allowed to sell it for $10 on your site, or modify it, as long as you keep my license. So someone could buy it for $10 from you and give it away for free.