Skip to content

Unique ID associated with button anchor tags #4535

@clickharder

Description

@clickharder

Prerequisites

  • I have searched for similar issues in both open and closed tickets and cannot find a duplicate.
  • The issue still exists against the latest stable version of Elementor.

Description

Anchor tags used for buttons do not have a unique ID associated with them. Assigning a unique ID or css class to the button widget associates the ID or class to the parent div instead of the anchor tag.

Ideally, there should be a unique identifier associated with each button anchor tag for identification and use for Google Analytics events.

A unique class or id could be included by adding the widget id to the anchor tag. A solution similar to this:

File: /elementor/includes/widgets/button.php

On line 423 within the render() function

$id_int = $this->get_id_int();
$this->add_render_attribute ( 'button', 'class', 'btn-'.$id_int );

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    request/enhancementIndicates an Enhancement Request for an existing feature.status/mergedIndicates when a Pull Request has been merged to a Release.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions