Search code examples
htmlwordpresstagswordpress-shortcode

How to add 'data-value' to the title of the page in WordPress


I want to add some custom JS functionality to my page. For this I want to add a value into the 'data-value' tag of the title.

What I want in HTML code is this: <h1 id="h" data-value="HYPERPLEXED">HYPERPLEXED</h1>

Thanks in advance.

enter image description here


Solution

  • Use the custom HTML widget and write your HTML in there.

    You can find the custom HTML widget by pressing the add widget (plus sign with blue background) button on the top left of the toolbar.

    Custom HTML widget

    Custom HTML widget with content