Advanced Tabs
-
Hello there!
I’m wondering if there is a way to add a custom link to a tab instead of using a template or content (text editor).
I’m trying to achieve this using a JS snippet, but I still can’t get it to work.
I appreciate some guidance to hopefully address this client requirement.
Thanks in advance,
LBadd_action( 'wp_footer', function () { ?> <script defer> // Select the target "li" element and the "span" element within it const targetLi = document.getElementById("my-custom-tab-ID"); const titleSpan = targetLi.querySelector(".eael-tab-title.title-after-icon"); // Create the "a" element with the link and target attribute const newAnchor = document.createElement("a"); newAnchor.; newAnchor.target = "_blank"; // Extract the title text from the span const titleText = titleSpan.textContent; // Wrap the title text with the "a" element newAnchor.textContent = titleText; titleSpan.textContent = ""; // Clear the existing text in the span titleSpan.appendChild(newAnchor); // Add the "a" element as a child of the span </script> <?php } );
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Advanced Tabs’ is closed to new replies.