Get HP Menu into Header

I’m using the Kadence theme and I want to either get the HP Menu block into that header or delete the HP Menu and just use the one that comes with Kadence.

Just to be clear, I’m talking about the menu that comes up after you add packages to the directory. Three links. Username, Post a Request and Add Listing.

I tried using the code here, but massive errors appear when I try to enable that inside of functions.php like so:

Blockquote Warning: Undefined property: stdClass::$publish in /nas/content/live/curlyhairsalon/wp-content/plugins/hivepress/includes/blocks/class-template.php on line 49

Fatal error: Uncaught Error: Call to a member function get_username() on null in /nas/content/live/curlyhairsalon/wp-content/plugins/hivepress/templates/user/login/user-login-link.php:9 Stack trace: #0 /nas/content/live/curlyhairsalon/wp-content/plugins/hivepress/includes/blocks/class-part.php(61): include() #1 /nas/content/live/curlyhairsalon/wp-content/plugins/hivepress/includes/blocks/class-container.php(106): HivePress\Blocks\Part->render() #2 /nas/content/live/curlyhairsalon/wp-content/plugins/hivepress/includes/blocks/class-container.php(106): HivePress\Blocks\Container->render() #3 /nas/content/live/curlyhairsalon/wp-content/plugins/hivepress/includes/blocks/class-template.php(116): HivePress\Blocks\Container->render() #4 /nas/content/live/curlyhairsalon/wp-content/plugins/hivepress/includes/components/class-template.php(139): HivePress\Blocks\Template->render() #5 /nas/content/live/curlyhairsalon/wp-content/themes/dusty/functions.php(22): HivePress\Components\Template->render_menu() #6 /nas/content/live/curlyhairsalon/wp-settings.php(566): include(’/nas/content/li…’) #7 /nas/content/live/curlyhairsalon/wp-config.php(121): require_once(’/nas/content/li…’) #8 /nas/content/live/curlyhairsalon/wp-load.php(50): require_once(’/nas/content/li…’) #9 /nas/content/live/curlyhairsalon/wp-blog-header.php(13): require_once(’/nas/content/li…’) #10 /nas/content/live/curlyhairsalon/index.php(17): require(’/nas/content/li…’) #11 {main} thrown in /nas/content/live/curlyhairsalon/wp-content/plugins/hivepress/templates/user/login/user-login-link.php on line 9

Please make sure that you added it to the header.php file, not functions.php. It should be added where the header is actually rendered, in the header.php file or the theme hook that renders in the header. Based on the error messages it seems that the added code is executed too early, when the user object is not available yet.

Thanks. I already had it in the header, but Kadence has their own hook based system. So you actually place it inside of template-parts–> header–> navigation.php instead.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.