Skip Navigation

[Resolved] Add CSS class to View block

This support ticket is created 3 years, 10 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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 3 replies, has 2 voices.

Last updated by nicholasM 3 years, 10 months ago.

Assisted by: Christian Cox.

Author
Posts
#1650871

There doesn't seem to be a way to add a custom CSS class to the View block.

#1650897

As discussed in our chat, the current workaround is to add a Container block and insert your View block inside the Container. Container blocks allow you to add custom CSS classes and ID. I have asked my 2nd tier support team to consider this as a missing feature or to let me know if there is something obvious I have missed. I will let you know what I find out.

#1653279
Screen Shot 2020-06-07 at 10.02.50 AM.png

Okay I got some feedback from 2nd tier, and it seems there is no other simple way to achieve this - wrapping the View block in a Container block is the best way to add custom CSS class or ID as an ancestor of the View's loop elements. We have put in a request to add "Advanced" settings to the View block and the View Output block unless there is a good reason not to do so. The View Search block already has these settings.

If you need the ability to add a CSS class to an element before the View's loop, but not necessarily to add the class to an ancestor of the loop elements, please note the attached screenshot. You can insert content after the View loop, then hover over that block and use the up and down arrows ("Move up" in the screenshot) to reorder the block elements such that the hookable element is before the View's loop but still inside the View Output block.

Thanks for the report, and be assured our developers will add the Advanced panel in upcoming releases of Views and Blocks.

#1653427

Sounds good, thanks!

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