WordPress.org

Ready to get started?Download WordPress

Forums

Custom Content Type Manager
[resolved] Conditional Custom Fields Depending on Tempate (2 posts)

  1. janpleva
    Member
    Posted 1 year ago #

    Hi,

    Is it possible to make CCTM show custom field only when I select some defined template and different ones when I select different template?

    I know it is possible with add_meta_box() as explained here: http://www.farinspace.com/page-specific-wordpress-meta-box/ but can I do that with CCTM as it would be way more convenient...

    Thanks

    http://wordpress.org/extend/plugins/custom-content-type-manager/

  2. fireproofsocks
    Member
    Plugin Author

    Posted 1 year ago #

    Someone else asked about this (see https://code.google.com/p/wordpress-custom-content-type-manager/issues/detail?id=481), and I'm not keen on the idea of conditional fields based on the template because it subverts the entire point of the architecture. Fields define the data model, so they belong unconditionally to a post-type. If you're wanting to change the fields that show up when you select a template, then you're probably blurring your view and model layers and that usually ends up messy and difficult to maintain. A template is merely a skin/view -- it's only concerned with how you wish to display data, not with what data should be allowed to be entered.

    As long as you're clear about the architecture here and you're only going for some eye-candy to streamline the manager, you might look into using a few custom tpls to inject some Javascript that could listen for changes and show/hide portions of the manager accordingly. Hidden fields also include some advanced options for executing some PHP on various events, so they could be used to greater effect here, but generally, I think customizations to this degree stray past the 80/20 rule.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic