Alternative solution to put custom post types into plugins.

tips-and-tricks

#1

Hi there! :blush:

As far as I know we need to put custom post types and other content generation features into plugins in order to get our themes accepted. Even though the official theme submission requirements doesn’t mention this, my latest theme got soft-rejected because of its custom post types, but that is not the main subject now.

I write this forum topic because I would like to share you my idea about an alternative solution that can prevent us to remove custom post types from our themes. First things first I’d like to note that I totally understand the intention behind this rule. I have read Justin Tadlock’s relevant article a few time I agree with it 100%. So, what is my problem here? Let’s see the pros and cons of putting a custom post type into a plugin ( from my point of view ):

Pros:

  • data portability
  • other authors can build a theme that uses my post types ( I think this not a real advantage here, but it plays a big role in the free community )
  • created contents might work with other themes, but the chance of this marginal since all of the premium themes / plugins have prefixed post type names

Cons:

  • It is more complicated to set up the theme since there is one more component that needs to be installed
  • We need to deal with the TGM Plugin Activation class that means more work and risk for us. What if something went wrong with that extension or its developers stop supporting it? I know the chance of this is minimal, but it can be happen.
  • More support tickets from buyers who forgot to install the plugin and don’t understand what’s wrong

As I see the only real important advantage of separating custom post types from themes is data portability, at least this is my personal opinion. It is important only if a user don’t want to loose the custom content when changing the theme, but it is very important in that scenario. Otherwise there is problem that makes me thinking. Even though we can bundle the plugins with the mentioned class easily ( but we are not allowed to activate them upon theme activation ), I’m pretty sure there will be many users who won’t activate the plugin, but will send one star ratings and support tickets instead. I know it sounds a bit ridiculous, but i have had some experience with customers in the past three years. Please don’t get me wrong, I really do respect my buyers and I do my best to give them any possible information in the help files, but they are not web professionals ( at least not all of them ) and some of them don’t even read my documentation and used to close important notifications without reading them. Moreover, I don’t think it is good idea to install plugins automatically with a third party extension even if it is a well known and reliable one like the TGMPA. You might think I have paranoia, but I try to avoid using third party php classes as much as possible.

So, I got an idea. What if we leave all of the custom post types in our themes and create a plugin with the exact same post types and include it to the main package as different zip file ( in other words the theme folder doesn’t contain the plugin files )? For example there would a theme called MyCustomTheme and plugin called MyCustomContents. Both of them would share the same post types. What is the sense behind this solution? Let’s see the pros and cons:

PROS:

  • no need for any third party class
  • easier to install the theme
  • less support tickets
  • we don’t need to explain why we removed content generation from the theme ( I guess the rest of the buyers know nothing about WordPress practices and guidelines, they just want to buy something complete )

CONS:

  • a bit more work

What if the user want to change the theme but don’t want to loose the contents? Just deactivate the theme, install the plugin and that’s all, the content will be there in the admin. Buyers don’t need to install any plugin as long as they use the same theme. In my opinion this would merge the pros of integrated and separated post types while don’t have any cons. According to my experiences buyers don’t really change premium themes really often, even so I think data portability is important, but not the most important in my opinion.

Anyway, please take this as an idea. To be honest I have never bundled any plugin with my themes, so I don’t have real experience with this yet. I just wanted to let you know my idea and my concerns about the current practice. My concerns might be wrong ( I’m really open minded ), so I would like to hear you opinions. It would be great to hear some experiences from authors who have themes with bundled plugins. Have you had any issues with customers because of this or it is just my fear?

Thanks for reading my post! :blush:

Regards,
Mark ( MagnaThemes )


#2

Bundling plugins is incredibly simple. You can reuse the exact plugin in multiple themes and even push plugin updates out to all your themes without having to update the much larger theme files. Also buyers can disable plugins if that particular custom post type (eg a portfolio or a store listing) is not required for the project.