-
Notifications
You must be signed in to change notification settings - Fork 61
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
WordPress 5 - conditionals don't work. Any ideas? #65
Comments
I think it is just a matter to test it and add the compatibility. If you
can test it yourself we can update this.
Den tor. 29. nov. 2018, 17:57 skrev dameer dj <[email protected]:
… Just as the title says, conditionals do not work under WordPress 5 release
candidate. Not sure whether it's Gutenberg shit or else. It shouldn't be
coz I recall that G developers decided to leave meta boxes as is. CMB2 is
fully functional tho.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#65>, or mute the
thread
<https://github.com/notifications/unsubscribe-auth/AC7sAl-K3WNM7s4cXaikIzGLzX9wDw7nks5u0BHdgaJpZM4Y6GRF>
.
|
I'm using the latest CMB2 branch/trunk, there are no javascript or server side errors - that's what I can say for sure. Other than that I doubt I'm skilled enough for some serious debugging. |
The issue is bascially that with Gutenberg there is also some updated markup for the editor. The form element with the id="post" does not exist anymore and this is actually what the cmb2-conditionals.js is referencing. Instead there is actually now a div element with the id="editor". I now tried to update the cmb2-conditionals.js in order that it gets initialized on #editor instead of #post but for some reason that doesn't have any effect. I then just removed the #post all together, but of course this script gets then initialized on every page. I just ended up by simply initializing the script on '.post-php, .post-new-php' which are basically 2 classes which are applied to the body element and are getting used on the editor pages. I keep testing this a bit more and will then PR |
I tried Joe's method and indeed it works a little.....like if you have a checkbox that adds a column or takes it away. if you change the #post to #editor it will initiate but not save and when you add new rows it doesn't take in account the conditionals. So for now I have installed the disable Gutenberg plugin and it restores the editor markup back to the original style and allows for conditionals to work. it sucks cause I use cmb2 to basically build out all my websites and to do that I need the conditionals to add columns and background images and animations and what not. So this is a bummer but hopefully we can figure it out and get it working cause the Gutenberg is kinda cool in that it uses flex and you can set up columns fairly easy. but to each there own. So yeah disable Gutenberg plugin will solve the conditional problems but still allow you to have the latest wordpress version |
@TheNewGuy16 Instead of #editor you should try .cmb2-wrap. For me it works just as fine as before. |
That doesn't work for me at all. Moreover, I've noticed that CMB2's color picker doesn't work too. Of course, regardless Conditionals. |
OK, here's the solution...
Things to keep on mind tho... Gutenberg doesn't use id Hope it helps! EDIT
...or anything similar that might suit your needs |
@dameer <https://github.com/dameer> would you be up to open a PR with such
a change?
Den søn. 9. des. 2018, 11:16 skrev dameer dj <[email protected]:
… OK, here's the solution...
1. Open "cmb2-conditionals/js/cmb2-conditionals.js"
2. scroll down to the file bottom
3. change
CMB2ConditionalsInit( '#post', '#post .cmb2-wrap' );
... to ...
CMB2ConditionalsInit( '.metabox-location-normal',
'.metabox-location-normal .cmb2-wrap' );
4. save, refresh, empty cache (BE SURE THE LATEST
"cmb2-conditionals.js" is loaded!)
Things to keep on mind tho...
Gutenberg doesn't use id #post on post/page edit screen any more.
.metabox-location-normal is the new form class for all the metaboxes
underneath the Gutenberg editor. I'm guessing the class name will be
different for metabox in different context ( 'side' or 'advanced' ), so try
with
.metabox-location-side or .metabox-location-advanced if your CMB2 metabox
context is different.
That's my presumption, it doesn't necessarily be true.
Hope it helps!
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#65 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AC7sAvgfdFxho6vRILDva65qfgei2QP3ks5u3OMSgaJpZM4Y6GRF>
.
|
You are the author of this plugin mate, give a shot to the code, consider the possible class name alterations and update. I don't wanna bother myself with Git stuff, I'm not into it. Beside, I've got too much work these days. |
Great open source spirit.
Den søn. 9. des. 2018, 11:41 skrev dameer dj <[email protected]:
… You are the author of this plugin mate, give a shot to the code, consider
the possible class name alterations and update. I don't wanna bother myself
with Git stuff, I'm not into it. Beside, I've got too much work these days.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#65 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AC7sAiMIjO-S2pVqgMPM3F1AZvJQFweOks5u3OjAgaJpZM4Y6GRF>
.
|
I'm sorry but this code doesn't make any sense at all. You actually init also on .cmb2-wrap, even within your fallback. Did you actually cleared your browsers cache after you've applied the modification I've suggested? @jcchavezs I already PR'ed. And there are also other PR's. Perhaps a good idea to finally look over them all? |
JoeHana, I'm not an expert but |
@dameer no, sorry - my bad. I was confused and thought you had just 2 classes in one param. However, its working for me with just one param which is .cmb2-wrap. But will do more testing later as I need to work with that on a current project anyway. Will review accordingly. |
Hi, You may watch the tutorial. how to use the addon as a plugin or how to use the plugin with your theme. |
Just as the title says, conditionals do not work under WordPress 5 release candidate. Not sure whether it's Gutenberg shit or else. It shouldn't be coz I recall that G developers decided to leave meta boxes as is. CMB2 is fully functional tho.
The text was updated successfully, but these errors were encountered: