Data- attributes

Hi Themeco,

It is possible to add HTML data-* custom attributes to sections, rows, columns, elements, etc. much in the same way custom ID and Class can be added to the many elements?

Like X itself using data-x- attributes, I’m sure you are aware many 3rd party libraries use data- attributes. Can these be added to the current release of X (in case I’ve missed it!) or upcoming V2 Elements or Pro?

Many thanks.

Hello,

Thank you for writing in!

Unfortunately, it isn`t possible, but you can accomplish it adding a RAW content with your own HTML code and your data-attributes.

You can find this element at X > Content > Elements > RAW Content

Many thanks.

I already understand about using Raw elements, however, this means effectively recreating the X elements myself, negating the purpose of the theme.

As noted, HTML data-* attributes are much more common and not limited to just elements. As with X sections, rows as columns can make use of them - used by X columns for example to achieve the fade effect.

Are the plans to introduce - to open up the potential and really allow users extend in a creative way - improve working with 3rd party libraries as well as the many other uses? My assumption is implementation would be much the same as already done for ID and CSS Class, the minor differencing being handling quotes " and ’ - though obviously, its own to the user to correctly open and close all quotes.

1 Like

Hello @ Strobley,

We really appreciate this feedback! We can add your feedback to our list of feature requests. This way it can be taken into consideration for future development.

Thanks!

Many thanks, much appreciated - It’s a tad bizarre and somewhat a double standard that a feature used by the X theme itself is not available for customers to use.

You’re welcome! :slight_smile:

Hi Paul, RueNel,

Wondered if there’s any update regarding this request for HTML data-* attributes? https://www.w3schools.com/tags/att_global_data.asp to be user defined much like CSS classes are?

I notice there are potential plans in coming release cycles to pull through contextual data? Would this be along the same lines and make use of data-* and finally allow X / Pro users to define their own data-* attribute or integrate 3rd party libraries that rely on them attributes?

Hey @strobley,

The contextual data refers to accessing WordPress data like a post title and featured image.

The data attribute should be an interface that can add a sort of like a custom field in elements directly. This is a known request but we cannot promise anything as of this stage.

Please stay tuned.

Thanks.