Skip Navigation

[Resolved] Custom JS and CSS code has stoped working

This thread is resolved. Here is a description of the problem and solution.

Problem:
JS and CSS code I used up and until now to customize the View's Loop output has stopped working after an update of Toolset Plugins.
What could it be?

Solution:
What can be is that your JS and CSS code was applying onto native HTML classes or IDs from the Toolset Plugins.
These might change, as it is up to Toolset Developers to name them and rename if required.
Such renaming happened from beta to stable release of Toolset Blocks, so code applied to Toolset Block in beta version may have stopped working.

You'd need to update your CSS and JS to address the right classes and IDs again.

However, note that generally this should be solved by adding your own classes and IDs in the HTML, and address those, instead of relying on eventual Toolset produced HTML that can change.

This support ticket is created 4 years, 3 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

This topic contains 4 replies, has 2 voices.

Last updated by Rune Brynestad 4 years, 3 months ago.

Assisted by: Beda.

Author
Posts
#1451517

This thread is related to "Need help with a custom loop output in a View " found here:
https://toolset.com/forums/topic/need-help-with-a-custom-loop-output-in-a-view/

Your supporter Waqar helped me with some custom JS and CSS for displaying 6 columns in the first row, 5 columns in the second row, 6 columns in the third row, 5 columns in the forth row and so on. It worked perfect

After upgarding Views from version 3.0 beta 2, the custom code does not work anymore if I open the page and save it.

It's on this site
hidden link

I have restored a backup on a test site so you can see how it looked like before the upgrade
hidden link

I need your help to see what's mess up the custom code.

Thanks in advice

Regards
Rune

#1452673

The working version of this uses Blocks, the not working version seems to use a Loop Wizard generated Grid (bootstrap).

These aren't the same HTML markups, classes and ids, so the code won't work
One is a wpv-grid-column, the other a wpv-block-column.
The "new-row new-row-margin" Div is completely missing, as well

This can't be the same View, even it has the same ID some changes must have been made.

Waqar's Custom Code addresses classes like wp-block-columns, wp-block-column, etc, which could have changed either due to the update or changes in the content of the View.

It is not to be relied on such classes if they come from any Plugin.
If you added them manually you can rely on, but a plugin can always change its classes at any moment.
This is also why we do not provide such custom code in the forum, strictly speaking.

You can try to change wp-block-columns in Waqar's code for the now used wpv-grid-column, but I fear this won't just simply solve this issue which surges from Custom JS code that was tailored to work on one very specific use case, which is depending on internal class names.

#1453411

Hi Beda

Thanks for looking into this. Both the working version and the non working version uses blocks. No question about that. You can log into my WordPress backend at hidden link with the WordPress access details I sent you and see it yourself.

I'm pretty sure it is the latest version of Toolset Views that mess up the front page. Everytime I open the page and save it, it breaks. Something converts some of the blocks HTML markups, classes and ids to grid view.

You can try it for yourself. hidden link works. Log into hidden link, open the frontpage and save it. You will see that some of the blocks have been converted to grid code

Same username and password as hidden link

I hope you cam tell me how to convert it back.

Thanks again for looking into this.

Regards
Rune

#1457435

Likely that is a class name that changed from beta release to the meanwhile stable release of blocks.
The code eventually needs to be updated to use the new classes.

It is always possible that custom code applied to arbitrary classes of any plugin may stop working because these arbitrary classes can (and will) change over time.
You could either add own classes or if you rely on core classes, update your code when the core classes change.

But that is not something the support of Toolset can provide, according to the support guidelines https://toolset.com/toolset-support-policy/

What you can do on this specific case, is update your code to use the classes that Toolset uses now:
- Instead of class "wp-block-columns" use "wpv-grid"
- Instead of class "wp-block-column" use "wpv-grid-column"

Then the code will work again, but still, rely on internal classes added by the plugin Toolset, so it may stop working again in the future. You'd then have to find the changes and update the code accordingly.

#1458663

My issue is resolved now. Thank you!

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.