Include multiple custom post types [closed]

The reason you can’t include both files is that you’ve named all the functions the same. You can’t have two functions named post_type or portfolio_messages etc.

Also I see a few other things wrong with your code.

  • The function names should be unique to your plugin/theme. So prepend the names with your theme/plugin name. So try mytheme_gallery_post_type and mytheme_portfolio_post_type etc.

  • The rewrite array should not be a part of $labels. Make it a part of $args instead.

  • Don’t run the taxonomy and custom post type names through the internationalization function. That is the first arg to register_post_type and register_taxonomy should not be run through __().

tech