Header fix — copy this code

No zip download needed

  1. Hostinger → File Manager
  2. Open public_html/wp-content/mu-plugins/ (create folder if missing)
  3. New file → name: hl-header-auth-fix.php
  4. Paste the code below → Save
  5. LiteSpeed → Purge cache → hard-refresh homepage
<?php
/**
 * Plugin Name: HL Header Auth Fix
 * Description: Places Sign in / Sign up inside the Kadence header bar (top right). Safe to remove after heylooai-branding 1.5.2+ is on the server.
 * Version: 1.0.0
 */

if ( ! defined( 'ABSPATH' ) ) {
    exit;
}

add_action(
    'plugins_loaded',
    static function (): void {
        if ( class_exists( 'HLAI_Auth' ) ) {
            remove_action( 'kadence_header', [ 'HLAI_Auth', 'render_header_auth' ], 28 );
        }
    },
    99
);

add_action(
    'wp_enqueue_scripts',
    static function (): void {
        if ( is_admin() ) {
            return;
        }
        $css = <<<'CSS'
#masthead .site-main-header-inner-wrap { position: relative !important; }
#masthead .hl-header-auth {
  position: absolute;
  right: clamp(0.5rem, 1.5vw, 1.25rem);
  top: 50%;
  transform: translateY(-50%);
  z-index: 25;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
#masthead + .hl-header-auth,
.site-header-wrap + .hl-header-auth,
body > .hl-header-auth { display: none !important; }
@media (min-width: 1025px) {
  #masthead .site-main-header-inner-wrap {
    padding-right: clamp(11rem, 14vw, 15rem);
  }
}
@media (max-width: 1024px) {
  #masthead .site-main-header-inner-wrap { padding-right: clamp(9rem, 22vw, 11rem); }
  #masthead .hl-header-auth { right: 3.5rem; }
}
CSS;
        wp_register_style( 'hl-header-auth-fix', false, [], '1.0.0' );
        wp_enqueue_style( 'hl-header-auth-fix' );
        wp_add_inline_style( 'hl-header-auth-fix', $css );
    },
    20
);

add_action(
    'wp_footer',
    static function (): void {
        if ( is_admin() ) {
            return;
        }

        $signin    = esc_url( home_url( '/sign-in/' ) );
        $signup    = esc_url( home_url( '/sign-up/' ) );
        $dashboard = esc_url( home_url( '/dashboard/' ) );
        $logged_in = is_user_logged_in();
        ?>
        <script>
        (function () {
          var loggedIn = <?php echo $logged_in ? 'true' : 'false'; ?>;
          var signin = <?php echo wp_json_encode( $signin ); ?>;
          var signup = <?php echo wp_json_encode( $signup ); ?>;
          var dashboard = <?php echo wp_json_encode( $dashboard ); ?>;

          function findHeaderAnchor() {
            return (
              document.querySelector('#masthead .site-main-header-inner-wrap') ||
              document.querySelector('#masthead .site-main-header-wrap .site-header-row-container-inner') ||
              document.querySelector('#masthead .site-header-row-container-inner') ||
              document.getElementById('masthead')
            );
          }

          function removeOrphanAuth() {
            document.querySelectorAll('.hl-header-auth').forEach(function (el) {
              var anchor = findHeaderAnchor();
              if (!anchor || !anchor.contains(el)) {
                el.remove();
              }
            });
          }

          function injectHeaderAuth() {
            removeOrphanAuth();
            if (document.querySelector('#masthead .hl-header-auth')) return;
            var anchor = findHeaderAnchor();
            if (!anchor) return;
            var wrap = document.createElement('div');
            wrap.className = 'hl-header-auth';
            wrap.setAttribute('role', 'navigation');
            wrap.setAttribute('aria-label', 'Account');
            if (loggedIn) {
              wrap.innerHTML = '<a href="' + dashboard + '" class="hl-auth-link hl-auth-link--dashboard">Dashboard</a>';
            } else {
              wrap.innerHTML =
                '<a href="' + signin + '" class="hl-auth-link">Sign in</a>' +
                '<a href="' + signup + '" class="hl-auth-btn">Sign up</a>';
            }
            anchor.appendChild(wrap);
          }

          if (document.readyState === 'loading') {
            document.addEventListener('DOMContentLoaded', injectHeaderAuth);
          } else {
            injectHeaderAuth();
          }
          setTimeout(injectHeaderAuth, 400);
        })();
        </script>
        <?php
    },
    2
);