Function and a widget issue

Hey there, I have a few questions regarding my theme.

“REQUIRED: The theme uses the register_post_type() function, which is plugin-territory functionality.” This is an error I receive when checking my theme. But this is a real concern for me, because two sections have been built via this function ( teams+players and about us ), must I change it or can I just let it be how it is?

Also, do I need to add WordPress widgets? Is it okay, if we don’t do that?

Best regards,
PixieSquad

Hey PixieSquad,

This year ThemeForest Review team changed the rulles. As the reviewer said, you cna’t register post types inside your theme.

But how to add this as a functionality?

  • You can add this functionality in a plugin and bundle it with your theme.
  • Widgets, shortcodes, post types are plugin-territory functionalities. You must insert them in a plugin.

Why this?

The answer is simple. To make client’s lives easier. For example if in one moment your buyer will want to change the theme but keep the members(for example, which is a post type build by your code from plugin), then all the members will remain on the site after changing the theme.

This is just an example. But this is the idea. :slight_smile:

I completely agree with @ThemeSLR
but this small technique works well to ignore the warning message during theme check.

$regsiter_post_type = ‘register_’ . ‘post_type’;
$regsiter_post_type( ‘POST_TYPE_NAME’, array() );

Thanks