| 1 |
<?php |
| 2 |
namespace Frontend; |
| 3 |
|
| 4 |
/** |
| 5 |
* Class Assets |
| 6 |
* @package EazyDocs\Admin |
| 7 |
*/ |
| 8 |
class Assets { |
| 9 |
|
| 10 |
/** |
| 11 |
* Assets constructor. |
| 12 |
*/ |
| 13 |
public function __construct() { |
| 14 |
add_action('wp_enqueue_scripts', [$this, 'frontend_scripts'], 999 ); |
| 15 |
} |
| 16 |
|
| 17 |
/** |
| 18 |
* Register scripts and styles [ FRONTEND ] |
| 19 |
*/ |
| 20 |
public function frontend_scripts() { |
| 21 |
|
| 22 |
wp_enqueue_style( 'bbpc-frontend-global', BBPC_ASSETS . 'frontend/css/frontend.css', array(), BBPC_VERSION ); |
| 23 |
|
| 24 |
// Elementor widgets styles |
| 25 |
wp_enqueue_style( 'bbpc-el-widgets', BBPC_ASSETS . 'css/el-widgets.css', ); |
| 26 |
wp_enqueue_style( 'bbpc-style', BBPC_ASSETS . 'css/custom.css' ); |
| 27 |
|
| 28 |
// Elementor widgets scripts |
| 29 |
wp_enqueue_script( 'bbpc_js', BBPC_ASSETS . 'js/forumTab.js', ['jquery'], true, true ); |
| 30 |
|
| 31 |
wp_enqueue_script( 'bbpc-frontend-js', BBPC_ASSETS . 'frontend/js/frontend.js', array('jquery'), BBPC_VERSION, true ); |
| 32 |
wp_register_script( 'bbpc-ajax', BBPC_ASSETS . 'js/ajax.js', array('jquery'), BBPC_VERSION, true ); |
| 33 |
|
| 34 |
// localize |
| 35 |
wp_localize_script( 'bbpc-frontend-js', 'bbpc_localize_script', array( |
| 36 |
'ajaxurl' => admin_url( 'admin-ajax.php' ), |
| 37 |
'nonce' => wp_create_nonce( 'bbpc-nonce' ), |
| 38 |
'bbpc_subscribed_link' => wp_kses_post(bbp_get_forum_subscription_link()), |
| 39 |
'bbpc_subscribed_forum_title' => bbpc_forum_title(), |
| 40 |
'bbpc_subscribed_forum_id' => bbp_get_forum_id() |
| 41 |
) ); |
| 42 |
|
| 43 |
$dynamic_css = ":root { --bbpc_brand_color: " . bbpc_get_opt('bbpc_brand_color') . "; }"; |
| 44 |
wp_add_inline_style( 'bbpc-frontend-global', $dynamic_css ); |
| 45 |
} |
| 46 |
} |