Creating a Custom Post Type Template MU Plugin

One of the great things about the Custompress plugin is that it defines custom post types, fields, and taxonomies community-wide.

But, to show fields or more advanced post-type creations, I need something more customized than single.php.

I’d like to pop plugin into mu plugins that creates a single-custom-post-type.php template on all blogs. Looking around the web, I haven’t found anything to help me out.

The template itself is easy coding. I’m just not sure about the rest of it.

Anyone have any insight or ideas?


  • gregfielding
    • The Incredible Code Injector


    What I want is to create a specialized real estate listing template, using a lot of custom fields. I’d like to have a uniform look on all sub-blogs in the community, regardless of the theme they use.

    As I understand it, custom post types will show on single.php or index.php by default. And, without the embed codes added to those files, custom fields won’t display.

    The solution on a single blog is to create a custom template or to add if/else php code to single.php – which is fine on one theme, but impractical on hundreds.

    If I could build a custom template that showed all the fields and somehow put it in mu-plugins, then the custom fields should work.

    Are you saying that there is an easier way to get custom fields to display? (cause just by attaching them to a cpt, they don’t, hence all of the embed codes)

  • Aaron
    • CTO

    Really your only options are to either filter the post content, or code custom templates into every single theme.

    In MarketPress I use the_content filter tied to the post type, then append my fields within and to the end of that. I also trick WP into using the theme’s default page.php template, as that’s least likely to have junk in it I don’t want like post date, categories, comments, etc.

  • gregfielding
    • The Incredible Code Injector

    Different thought…

    Creating a custom post type is easy to do with an mu-plugin. Is there a way to direct that post type to display on a template outside of the theme?

    Maybe I could create a “Listing” template somewhere that all of my sub-blog sites use to display the listing custom post types.


Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.