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 __().
Related Posts:
- Order by & include array by specific post ids
- Show certain terms from custom taxonomy but exclude ‘parent’ terms?
- Including an External File in a Post (and Using Processed Paths)
- Custom meta box includes
- Do I need a nonce field for every meta box I add to my custom post type admin?
- Restrict custom post type to only site administrator role
- Check if a custom taxonomy archive page is being displayed
- How to limit the number of terms (terms acts like categories)
- Removing custom post type from link search results
- Search multiple custom fields by using meta_query
- How can I get next/ previous post links to order by a filter (by the last word of the title)?
- Filtering Posts by Multiple Taxonomy Terms such as in an Admin Post Listing?
- How do I Make a custom post type get a custom post template in a plugin
- Check if current user has post in post type and is author role
- Separating Search Results By Post Type
- Including a custom post type in the Archives widget
- Add custom taxonomy to custom post type
- How do I add a custom post type to the Featured Content in twenty fourteen theme?
- Set default option in dropdown of WP_Query?
- How can I add single catogory for custom post type?
- Custom post type loops with different page templates
- Display posts in random post types
- Custom Post Types: Custom columns with Title submenu?
- Automatically Insert Custom Field on Custom Post Type Publish
- Create XML files on post edit screen
- Creating a custom post type using a object oriented approach?
- CPT Search Form with Taxonomy filter & Or
- Multiple templates for a custom post type
- Custom WP_Query not returning results when querying custom post type
- Weird problem happening with custom taxonmy when creating/updating posts
- Custom post type not using it’s own single-postname.php
- $wpdb: Counting posts corresponding to 3 terms in 3 different taxonomies
- Custom meta box not saving
- How to display selected taxonomies by their parent
- How to create shortcode to display custom field value on a custom post type
- Convert simple SQL Query to WordPress query
- How to set up multisite for multi language?
- Order query using custom meta data
- Get latest 3 posts from multiple CPT in one query
- Categories of Custom Post throws gives 404
- Ajax Custom Post Filter is not filtering
- Need Output Custom Taxonomy from Custom Post Type
- Display all taxonomy terms, add class if term applies to current post
- Woocommerce search pagination not working
- Completely remove custom post type permalinks (“One Page” website)
- WordPress custom post type split into pages
- Permalinks: custom post type -> custom taxonomy -> post
- How do i search authors from search form using author’s name
- Custom Post Types hierarchy and rewrite
- How do I know the ‘meta_key’ for ordering my custom post type
- How to get the intersection of two terms both from different custom taxonomies
- Facebook social publisher and custom post type fields [closed]
- Custom post type’s permalink adds the name of the post type before the post name
- Checking if $_FILE isset for an array of file upload metaboxes
- Which custom post type does the current post belong to?
- Custom post type showing same Post on all Pages
- WordPress Custom Post Type – show only certain posts that have specific taxonomy set
- get parent content inside child posts
- How to get specific post meta by title or id
- Why are some of my custom posts not showing up on my page?
- display custom taxonomies limited to custom post type?
- Populate a custom field dropdown with post titles by author
- Use core block functionality in a custom block gutenberg
- Add form after woocommerce admin order edit
- Get assigned post categories
- Is there SEO or related limitations to using Custom Post Types instead of WPMU?
- How do I show a link or ‘Read More’ button on a custom field excerpt when it is less than the word limit
- Custom Post Type and Taxonomy Loop Output Is Wrong
- Multiple custom post types showing up in edit.php
- How do I get the index for a custom post?
- Commas not displaying in implode
- “Cannot redeclare cpt_reg_tax()” because of functions.php
- custom taxonomy listing returns no posts
- Custom Post Type and Breadcrumbs Conflict
- Writing a custom Glossary plugin
- Reveal Foundation modal displaying repeat content on all modal rather dynamic content
- How to show Custom Post Types under Taxonomy in a new WordPress page template?
- How we can create menu from Appearance > Menu and use as a add-submenu-page for admin menu?
- Custom Post Type Category Displaying ALL Sub Categories as well
- Custom Endpoint For Specific Custom Post Type
- How to only display all posts to a custom User Role?
- Change the term based on the value of a $variable using wp_update_post in submitting a form
- Can I organise my custom post types by page?
- Display posts of a hierarchical custom post type excluding parent posts
- Wrap an X amount of taxonomy posts in a separate Row in WordPress
- Looping through custom taxonomy in one template
- get_post_meta for Custom Post Type ( CPT )
- Site loads very slow for archive custom post type page
- How to get $post object available inside functions.php to localize script?
- WordPress loop for multiple custom post types
- How can I base a query off of the current page post type AND a meta value from another custom post type
- Plugins for putting Custom Post Types into the Menu
- Fallback if statement based on the number filtered from it
- Custom Post Types, Taxonomies and Terms… I’m getting confused now!
- Don’t display post if post has empty body
- Posts picking up old Permalinks, how to reset?
- Remove slug from Custom Category Permalink + dual-category permalinks
- How to query posts by category with the_title();
- get_the_post_navigation not working
- Sort ACF by custom taxonomy