jcchavezs / cmb2-conditionals

Plugin to relate fields in a CMB2 metabox
GNU General Public License v2.0
86 stars 61 forks source link

cmb2-conditionals should only work on cmb2 fields/metaboxes not all of them #51

Open sbouafif opened 7 years ago

sbouafif commented 7 years ago

Hello,

For a client, I'm using another plugin (Post Public Preview - https://wordpress.org/plugins/public-post-preview/) to create a preview link for non logged in users when the post is in draft mode.

The plugin work like this:

When using it with cmb2-conditionnals, cmb2-conditionnals set the Post Public Preview's input field to visible instead of the normal behavior (hidden).

A quick fix for this is to enable cmb2-conditionals only for cmb2 metaboxes and not the entire post page by replacing "CMB2ConditionalsInit( '#post', '#post .cmb2-wrap' );" with "CMB2ConditionalsInit( '.cmb2-postbox', '#post .cmb2-wrap' );"

jrfnl commented 7 years ago

AFAIR if you did that, you would not be able to have a condition which depends on for instance the publish status and you wouldn't be able to have a condition depending on the status of a field another plugin adds.

sbouafif commented 7 years ago

Oh I didn't see that cmb2-conditionals works with conditions with fields not created by cmb2. I was only using it with fields I created with cmb2.

The issue can be closed then ;)