<?php
// Only show footer if not hidden in Customizer

echo "</div>";


wp_footer(); 


if (!get_theme_mod('my_plugin_hide_footer')) :
?>
    <div class="firefly-footer" style="background-color:black;padding:5px;font-size:12px;margin-bottom:0px;color:white;">
        <div class="firefly-footer-left">
            © <?php echo date("Y"); ?> <?php echo get_bloginfo('name'); ?> 



            <?php if (get_theme_mod('my_plugin_show_terms_link', true) && !get_theme_mod('my_plugin_hide_footer', false)) : ?>
    | <a href="/terms-and-conditions" style="color:white;text-decoration:none;">Terms and Conditions</a>
<?php endif; ?>


<?php if (get_theme_mod('my_plugin_show_search_link', false) && !get_theme_mod('my_plugin_hide_footer', false)) : ?>
    | <a href="/search" style="color:white;text-decoration:none;">Search site</a>
<?php endif; 


 if ( current_user_can('manage_options') ) {
        echo do_shortcode("[adminlinks]");


        echo '<script>
document.addEventListener("DOMContentLoaded", function() {
    if (localStorage.getItem("showAdminLinks") === "1") {
        var el = document.getElementById("toggle-admin-links-sc");
        if (el) el.textContent = "Hide admin links";
    }
});
</script>';


 }

?>
        </div>

      <div class="firefly-footer-right">
    Built by <a href="https://fireflywebsites.co.nz" target="_blank" style="color:white;">Firefly Websites</a> | Powered by 
    <a href="https://www.rainbowcreative.co.nz" style="color:white;text-decoration:none;" target="_blank">Rainbow Creative</a> 
    | 
    <?php if ( is_user_logged_in() ) : ?>
        <a href="<?php echo esc_url( wp_logout_url( home_url('/firefly') ) ); ?>" style="color:white;text-decoration:none;">Log off</a>
    <?php else : ?>
        <a href="/firefly" style="color:white;text-decoration:none;">Admin</a>
    <?php endif; ?>
</div>

    </div>
<?php
endif;


?>