Title: widget code
Last modified: March 10, 2023

---

# widget code

 *  Resolved [mikmoro](https://wordpress.org/support/users/mikmoro/)
 * (@mikmoro)
 * [3 years, 3 months ago](https://wordpress.org/support/topic/widget-code-9/)
 * Good afternoon. I had added the role=”button” part to the widget code part, because
   it’s needed to properly comply with the accessibility standard. Now that part
   of the code is gone (now it’s additional CSS), and I can’t find where it’s generated.
   Thank you.

Viewing 7 replies - 1 through 7 (of 7 total)

 *  Plugin Author [edo888](https://wordpress.org/support/users/edo888/)
 * (@edo888)
 * [3 years, 3 months ago](https://wordpress.org/support/topic/widget-code-9/#post-16548323)
 * Hi,
 * You can possibly do that via javascript. If you are adding role attribute to 
   language link elements something like should do the trick for you: `jQuery('a[
   data-gt-lang]').attr('role', 'button')`
 * You will need to place that code into the footer area of your website.
 * Thanks! 🙂
 *  Thread Starter [mikmoro](https://wordpress.org/support/users/mikmoro/)
 * (@mikmoro)
 * [3 years, 3 months ago](https://wordpress.org/support/topic/widget-code-9/#post-16548344)
 * Thank you very much for your reply. I don’t quite understand, that is: until 
   half an hour ago, the box in the settings showed how to modify the generated 
   HTML code to your liking, so it allowed me to add that attribute without problem.
   The plugin has been updated and now it no longer complies with the accessibility
   standard (use that “role button” when using link tags instead of buttons for 
   actions), removing my attributes added to each link. I’m assuming that HTML is
   generated in some PHP file, and I’d like to know where to edit it to add the 
   attribute back.
   I find it easier than trying to add that javascript code, which
   I’m not sure where I would need to do to make it work. Thank you very much again.
 *  Plugin Author [edo888](https://wordpress.org/support/users/edo888/)
 * (@edo888)
 * [3 years, 3 months ago](https://wordpress.org/support/topic/widget-code-9/#post-16548354)
 * Hi,
 * That is correct. Widget HTML feature is removed in version 3.0.1.
 * I would suggest you to add the code into your theme (most likely footer.php file)
   in an appropriate location. I propose you know HTML/JavaScript/PHP and you will
   find your way around, if not then please consult your developer or use our paid
   version and we can support to do that customization through our live chat.
 * Thanks! 🙂
 *  Thread Starter [mikmoro](https://wordpress.org/support/users/mikmoro/)
 * (@mikmoro)
 * [3 years, 3 months ago](https://wordpress.org/support/topic/widget-code-9/#post-16548371)
 * Okay, thank you very much. This may have affected a lot of people with personal
   adaptations in the widget code.
   Perhaps it would be a good idea to make that 
   small modification to comply with the accessibility standard in the use of type“
   a” links for the actions that a button should carry out.
 * [https://equalizedigital.com/accessibility-checker/improper-use-of-link/?utm_source=accessibility-checker&utm_medium=software&utm_term=link_improper&utm_content=content-analysis&utm_campaign=wordpress-general&php_version=8.1.16&platform=wordpress&platform_version=6.1.1&software=free&software_version=1.3.18&days_active=2](https://equalizedigital.com/accessibility-checker/improper-use-of-link/?utm_source=accessibility-checker&utm_medium=software&utm_term=link_improper&utm_content=content-analysis&utm_campaign=wordpress-general&php_version=8.1.16&platform=wordpress&platform_version=6.1.1&software=free&software_version=1.3.18&days_active=2)
 * I will try to fix it.
   Greetings.
 *  Plugin Author [edo888](https://wordpress.org/support/users/edo888/)
 * (@edo888)
 * [3 years, 3 months ago](https://wordpress.org/support/topic/widget-code-9/#post-16548379)
 * Good point, I’ll consider adding `role="button"` attribute for link elements.
 * Thanks! 🙂
    -  This reply was modified 3 years, 3 months ago by [edo888](https://wordpress.org/support/users/edo888/).
 *  Thread Starter [mikmoro](https://wordpress.org/support/users/mikmoro/)
 * (@mikmoro)
 * [3 years, 3 months ago](https://wordpress.org/support/topic/widget-code-9/#post-16548404)
 * Glad to hear it. Thank you for your help.
 *  Thread Starter [mikmoro](https://wordpress.org/support/users/mikmoro/)
 * (@mikmoro)
 * [3 years, 3 months ago](https://wordpress.org/support/topic/widget-code-9/#post-16549438)
 * FIXED. In case it happens to someone else, just adding the attribute in the corresponding
   JS file fixes it. In this case, the file is “wp-content/plugins/gtranslate/js/
   fc.js” (depending on the chosen widget type). Adding the attribute on line 95
   adds it to the HTML without a problem:
 * languages.forEach(function(lang) {
   var el_a = document.createElement(‘a’);el_a.
   href = get_lang_href(lang);el_a.title = lang_array[lang];el_a.setAttribute(‘data-
   gt-lang’, lang);**el_a.setAttribute(‘role’, ‘button’);**el_a.classList.add(‘glink’,‘
   nturl’, ‘notranslate’);lang == current_lang && el_a.classList.add(‘gt-current-
   lang’);

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘widget code’ is closed to new replies.

 * ![](https://ps.w.org/gtranslate/assets/icon-256x256.png?rev=2595917)
 * [Translate Wordpress with GTranslate](https://wordpress.org/plugins/gtranslate/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/gtranslate/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/gtranslate/)
 * [Active Topics](https://wordpress.org/support/plugin/gtranslate/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/gtranslate/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/gtranslate/reviews/)

 * 7 replies
 * 2 participants
 * Last reply from: [mikmoro](https://wordpress.org/support/users/mikmoro/)
 * Last activity: [3 years, 3 months ago](https://wordpress.org/support/topic/widget-code-9/#post-16549438)
 * Status: resolved