Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
sbouafif opened this issue Oct 24, 2017 · 2 comments

Comments

@sbouafif
Copy link

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:

  • Adds a checkbox and an input field containing the url in the "submit box"
  • the input field is not displayed when the checkbox is not checked
  • when the checkbox is clicked, it hides or shows the input field while making an ajax request

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
Copy link
Collaborator

jrfnl commented Oct 24, 2017

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
Copy link
Author

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 ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants