Home / Attachments / fix border
Duplicate Snippet

Embed Snippet on Your Site

fix border

Code Preview
php
<?php
<?php
/*
Plugin Name: Dynamic Border Customizer
Description: Adds coral borders to specific elements.
*/
add_action('wp_footer', function() {
    ?>
    <script>
        document.addEventListener("DOMContentLoaded", function() {
            // Apply border to element with ID 'myElement'
            let element = document.getElementById("myElement");
            if (element) {
                element.style.border = "3px solid coral";
                element.style.borderRadius = "15px";
                element.style.padding = "1rem";
            }
            // Optional: Apply to all elements with a specific class
            let cards = document.querySelectorAll(".wp-block-group");
            cards.forEach(function(card) {
                card.style.border = "2px dashed coral";
                card.style.borderRadius = "20px";
                card.style.padding = "1.5rem";
            });
        });
    </script>
    <?php
});
?>

Comments

Add a Comment