# bbp-core/2.4.3/includes/Frontend/Frontend_Assets.php

Forumax – AI Powered Advanced Community Forum Plugin, version 2.4.3. 150 lines.

- Page: https://pluginprobe.com/plugins/bbp-core/2.4.3/code/includes/Frontend/Frontend_Assets.php
- Raw: https://pluginprobe.com/plugins/bbp-core/2.4.3/raw/includes/Frontend/Frontend_Assets.php
- Modified: 2026-08-01T14:38:00+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/bbp-core/2.4.3/code/includes/Frontend/Frontend_Assets.php#L10-L20`.

```php
<?php
namespace Frontend;

/**
 * Class Assets
 * @package EazyDocs\Admin
 */
class Frontend_Assets
{

	/**
	 * Assets constructor.
	 */
	public function __construct()
	{
		add_action('wp_enqueue_scripts', [$this, 'frontend_scripts'], 999);
		add_action('elementor/widgets/widgets_registered', [$this, 'bbpc_elementor_script'], 999);

	}

	/**
	 * Register scripts and styles [ ELEMENTOR ]
	 */
	public function bbpc_elementor_script()
	{
		// Elementor widgets scripts
		wp_enqueue_style('bbpc-el-widgets', FORUMAX_STYLES . 'frontend/el-widgets.css', array(), FORUMAX_VERSION);
		wp_enqueue_style('elegant-icon', FORUMAX_VEND . 'elegant-icon/style.css');
		wp_register_script('bbpc_js', FORUMAX_FRONT_ASS . 'js/forumTab.js', ['jquery'], true, true);
		wp_register_script('bbpc-frontend-js', FORUMAX_FRONT_ASS . 'js/frontend.js', array('jquery'), FORUMAX_VERSION, true);
		wp_register_script('bbpc-ajax', FORUMAX_FRONT_ASS . 'js/ajax.js', array('jquery'), FORUMAX_VERSION, true);

		if (is_rtl()) {
			wp_enqueue_style('bbpc-rtl', FORUMAX_STYLES . 'frontend/bbpc-main-rtl.css');
		}
	}

	/**
	 * Register scripts and styles [ FRONTEND ]
	 */
	public function frontend_scripts()
	{

		if (!class_exists('bbPress') || !class_exists('Forumax')) {
			return;
		}

		// Register front-end scripts/styles first so they are available for Gutenberg/Elementor blocks.
		wp_register_script('bbpc-ajax', FORUMAX_FRONT_ASS . 'js/ajax.js', array('jquery'), FORUMAX_VERSION, true);
		wp_register_script('bbpc-frontend-js', FORUMAX_FRONT_ASS . 'js/frontend.js', array('jquery'), FORUMAX_VERSION, true);

		// Always localize 'forumax_localize_script' on 'jquery' (since it is loaded everywhere) if bbPress exists.
		// This guarantees that any script requiring these variables won't fail with a ReferenceError.
		wp_localize_script('jquery', 'forumax_localize_script', array(
			'ajaxurl' => admin_url('admin-ajax.php'),
			'nonce' => wp_create_nonce('forumax-nonce'),
			'bbpc_subscribed_link' => wp_kses_post(bbp_get_forum_subscription_link()),
			'bbpc_subscribed_forum_title' => forumax_forum_title(),
			'bbpc_subscribed_forum_id' => bbp_get_forum_id(),
			'bbp_topic_id' => get_the_ID()
		));

		wp_register_style('bbpc-single', FORUMAX_STYLES . 'frontend/forum-single.css', array(), FORUMAX_VERSION);
		wp_register_style('bbpc-forum', FORUMAX_STYLES . 'frontend/forum.css', array(), FORUMAX_VERSION);

		if (!function_exists('is_bbpress') || !is_bbpress()) {
			return;
		}

		wp_enqueue_style('elegant-icon', FORUMAX_VEND . 'elegant-icon/style.css');
		wp_register_script('bbpc-wp-widget', FORUMAX_ASSETS . 'frontend/js/wp-widgets.js', array('jquery'), FORUMAX_VERSION, true);

		// Nice Select for frontend (prefixed to avoid conflicts)
		wp_register_style('frmx-nice-select', FORUMAX_VEND . 'frmx-nice-select/nice-select.css');
		wp_register_script('frmx-nice-select', FORUMAX_VEND . 'frmx-nice-select/jquery.nice-select.min.js', array('jquery'), '1.0', true);

		$bbpc_brand_color = forumax_get_opt('bbpc_brand_color');
		if ( ! empty( $bbpc_brand_color ) ) {
			$dynamic_css = sprintf(
				':root { --bbpc_brand_color: %s; }',
				sanitize_hex_color( $bbpc_brand_color )
			);
			wp_add_inline_style( 'bbpc-single', $dynamic_css );
		}


		wp_register_script('bbpc-voting', FORUMAX_FRONT_ASS . 'voting/bbpc-voting.js', ['jquery'], FORUMAX_VERSION);
		wp_register_script('forumax-custom', FORUMAX_FRONT_ASS . 'js/custom.js', ['jquery'], FORUMAX_VERSION);
		wp_register_script('bbp-replies-sorting', FORUMAX_FRONT_ASS . 'js/bbp-replies-sorting.js', ['jquery'], FORUMAX_VERSION);
		wp_register_script('docy-forum', FORUMAX_FRONT_ASS . 'js/forum.js', ['jquery'], FORUMAX_VERSION);
		wp_register_script('frmx-inline-edit', FORUMAX_FRONT_ASS . 'js/frmx-inline-edit.js', ['jquery'], FORUMAX_VERSION, true);

		wp_enqueue_style('bbpc-single');
		wp_enqueue_style('bbpc-forum');
		wp_enqueue_style('bbpc-voting', FORUMAX_FRONT_ASS . 'voting/bbpc-voting.css');
		wp_enqueue_style('frmx-nice-select');

		wp_enqueue_script('frmx-nice-select');
		wp_enqueue_script('forumax-custom');
		wp_enqueue_script('bbp-replies-sorting');
		wp_enqueue_script('docy-forum');
		wp_enqueue_script('bbpc-voting');
		wp_enqueue_script('bbpc-frontend-js');

		// Ensure TinyMCE scripts are queued early on all forumax editor pages
		if ( bbp_is_single_topic() || bbp_is_single_forum() || bbp_is_reply_edit() || bbp_is_topic_edit() ) {
			wp_enqueue_editor();
		}

		// Inline edit — only on single topic pages.
		if ( bbp_is_single_topic() ) {

			wp_enqueue_script( 'frmx-inline-edit' );
			wp_localize_script( 'frmx-inline-edit', 'frmxInlineEdit', array(
				'ajaxurl'  => admin_url( 'admin-ajax.php' ),
				'nonce'    => wp_create_nonce( 'forumax-nonce' ),
				'topic_id' => bbp_get_topic_id(),
				'i18n'     => array(
					'edit'              => esc_html__( 'Edit', 'forumax' ),
					'save'              => esc_html__( 'Save', 'forumax' ),
					'cancel'            => esc_html__( 'Cancel', 'forumax' ),
					'saving'            => esc_html__( 'Saving…', 'forumax' ),
					'loading'           => esc_html__( 'Loading…', 'forumax' ),
					'title_label'       => esc_html__( 'Topic Title', 'forumax' ),
					'content_label'     => esc_html__( 'Topic Content', 'forumax' ),
					'title_required'    => esc_html__( 'Title cannot be empty.', 'forumax' ),
					'content_required'  => esc_html__( 'Content cannot be empty.', 'forumax' ),
					'error'             => esc_html__( 'Something went wrong. Please try again.', 'forumax' ),
					'editing_reply'     => esc_html__( 'Editing reply', 'forumax' ),
					'to_save'           => esc_html__( 'to save', 'forumax' ),
					'to_cancel'         => esc_html__( 'to cancel', 'forumax' ),
					'unsaved_changes'   => esc_html__( 'Unsaved changes', 'forumax' ),
					'discard_confirm'   => esc_html__( 'Discard unsaved changes?', 'forumax' ),
					'discard'           => esc_html__( 'Discard', 'forumax' ),
					'keep_editing'      => esc_html__( 'Keep editing', 'forumax' ),
				),
			) );
		}


		// User page styles
		if ( function_exists( 'bbp_is_single_user' ) ) {
			if ( bbp_is_single_user() || bbp_is_favorites() || bbp_is_subscriptions() || bbp_is_single_user_engagements() || bbp_is_single_user_topics() || bbp_is_single_user_replies() || bbp_is_single_user_edit() || bbp_is_single_user_profile() ) {
				wp_enqueue_style('bbpc-forum-user', FORUMAX_STYLES . 'frontend/forum-user.css');
			}
		}
	}
}

	
```
