/**
* Theme Name: The Practitioner Child
* Description: This is a child theme of The Practitioner.
* Author: <a href="https://cmsmasters.net/">cmsmasters</a>
* Template: the-practitioner
* Version: 1.0.0
* Tested up to: 6.6
* Requires PHP: 7.4
* License:
* License URI:
* Text Domain: the-practitioner-child
* Copyright: cmsmasters 2025 / All Rights Reserved
*/


function bloomyn_anchor_scroll_script() {
?>
<script>
document.addEventListener("DOMContentLoaded", function() {
    // Check if URL has a hash
    if (window.location.hash) {
        var hash = window.location.hash;
        
        setTimeout(function() {
            var target = document.querySelector(hash);
            if (target) {
                var offset = 100; // adjust for fixed header height
                var topPos = target.getBoundingClientRect().top + window.pageYOffset - offset;
                window.scrollTo({
                    top: topPos,
                    behavior: 'smooth'
                });
            }
        }, 300); // small delay for page load
    }
});
</script>
<?php
}
add_action('wp_footer', 'bloomyn_anchor_scroll_script');