Where do we add this code in the theme and part codes?

Where do we add this code in the theme and part codes?

add_filter(
	'hivepress/v1/menus/user_account',
	function ( $menu ) {
		if ( is_user_logged_in() ) {
			$vendor_id = HivePress\Models\Vendor::query()->filter(
				[
					'user' => get_current_user_id(),
				]
			)->get_first_id();

			if ( $vendor_id ) {
				$menu['items']['vendor_view'] = [
					'label'  => 'Vendor Profile',
					'url'    => hivepress()->router->get_url( 'vendor_view_page', [ 'vendor_id' => $vendor_id ] ),
					'_order' => 123,
				];
			}
		}

		return $menu;
	},
	1000
);

Please follow these instructions How to add custom code snippets - HivePress Help Center

1 Like

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