slug = Helper::getPortalSlug(); if ($this->slug !== '') { add_rewrite_rule('^' . $this->slug . '/?$', 'index.php?fcom_route=portal_home', 'top'); // For /hooks add_rewrite_rule('^' . $this->slug . '/(.+)/?', 'index.php?fcom_route=$matches[1]', 'top'); } }); add_filter('query_vars', function ($vars) { $vars[] = 'fcom_route'; return $vars; }); add_action('template_redirect', function () { $hook_path = get_query_var('fcom_route'); if ($hook_path) { $this->currentPath = $hook_path; $this->renderFullApp(); } if ($this->slug === '') { global $wp; $currentRequest = $wp->request; if ($hookPath = Helper::getPortalRequestPath($currentRequest)) { $this->currentPath = $hookPath; $this->renderFullApp(); } } }, 1); add_action('fluent_community/portal_html', function () { App::make('view')->render('portal.portal'); }); add_action('fluent_community/portal_header', function ($context) { $this->getPortalHeader(true, $context); }); add_action('fluent_community/portal_sidebar', function ($context) { $this->getPortalSidebar(true, $context); }); add_action('fluent_community/enqueue_global_assets', function ($useDefaultTheme = true) { $isRtl = Helper::isRtl(); wp_enqueue_style('fluent_community_global', Vite::getStaticSrcUrl('global.css', $isRtl), [], FLUENT_COMMUNITY_PLUGIN_VERSION, 'screen'); if ($useDefaultTheme) { wp_enqueue_style('fluent_community_default_theme', Vite::getStaticSrcUrl('theme-default.css', $isRtl), [], FLUENT_COMMUNITY_PLUGIN_VERSION, 'screen'); } $css = Utility::getColorCssVariables(); wp_add_inline_style('fluent_community_global', $css); wp_enqueue_script('portal_general', Vite::getStaticSrcUrl('portal_general.js'), [], FLUENT_COMMUNITY_PLUGIN_VERSION, [ 'in_footer' => true ]); wp_localize_script('portal_general', 'fcom_portal_general', $this->getGlobalScriptVars()); if (Utility::isCustomizationEnabled('enable_sidebar_toggle')) { add_action('fluent_community/before_portal_dom', [$this, 'renderSidebarCollapseFouc'], 1); } }); add_action('admin_bar_menu', function ($wp_admin_bar) { if (!\FluentCommunity\App\Services\Helper::canAccessPortal()) { return; } // Add custom link within site name dropdown $wp_admin_bar->add_node(array( 'id' => 'fluent-community-link', 'title' => __('Visit Community Portal', 'fluent-community'), 'href' => \FluentCommunity\App\Services\Helper::baseUrl('/'), 'parent' => 'site-name' )); }, 99); add_action('fluent_community/top_menu_right_items', [$this, 'renderTopMenuRightItems']); add_action('fluent_community/after_portal_sidebar', function () { if (did_action('fluent_community/after_header_right_menu_items')) { echo '