[Resolved] Possible to add class and other data-elements to tag

Home Forums Support [Resolved] Possible to add class and other data-elements to tag

Home Forums Support Possible to add class and other data-elements to tag

  • This topic has 3 replies, 2 voices, and was last updated 4 months ago by David.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #2181274
    Eugene

    Hi there

    2 part question:

    1) Is it possible to add a class to an <a> tag directly in the editor? I could only get the class on the parent <p> element: https://prnt.sc/1DrS-jWCxmZd

    2) More advanced: Is there a way to add data-attributes to <a> tags? Example:
    <a class="villa-list-item enquire-modal-listing" data-villa="Villa Boma" data-action="Enquire Now" data-location="Listing" target="_self" href="#enquire-now-popup" data-lity=""></a>

    #2181279
    David
    Staff
    Customer Support

    Hi there,

    the block editor doesn’t allow for that.
    You would need to switch to the Code Editor ( 3 dot menu in top bar ) to edit the HTML.

    WP may not like that – and if thats the case then you would need to use a HTML block.

    #2181281
    Eugene

    Thanks!

    #2181300
    David
    Staff
    Customer Support
Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.