Skip to content

Commit

Permalink
load CSS & JS files only for this plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
jibon57 committed Aug 15, 2022
1 parent b0e7751 commit 060bf5e
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions plugnmeet/admin/class-plugnmeet-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,11 @@ public function __construct($plugin_name, $plugin_prefix, $version) {
* @since 1.0.0
*/
public function enqueue_styles($hook_suffix) {
wp_enqueue_style('bootstrap-min', plugin_dir_url(__FILE__) . 'css/bootstrap.min.css');
wp_enqueue_style('bootstrap-colorpicker', plugin_dir_url(__FILE__) . 'css/bootstrap-colorpicker.min.css');
wp_enqueue_style($this->plugin_name, plugin_dir_url(__FILE__) . 'css/plugnmeet-admin.css');
if (preg_match("/plugnmeet/", $hook_suffix) || preg_match("/plug-n-meet/", $hook_suffix)) {
wp_enqueue_style('bootstrap-min', plugin_dir_url(__FILE__) . 'css/bootstrap.min.css');
wp_enqueue_style('bootstrap-colorpicker', plugin_dir_url(__FILE__) . 'css/bootstrap-colorpicker.min.css');
wp_enqueue_style($this->plugin_name, plugin_dir_url(__FILE__) . 'css/plugnmeet-admin.css');
}
}

/**
Expand All @@ -81,10 +83,11 @@ public function enqueue_styles($hook_suffix) {
*/
public function enqueue_scripts($hook_suffix) {
wp_enqueue_media();
wp_enqueue_script("bootstrap-bundle", plugin_dir_url(__FILE__) . 'js/bootstrap.bundle.js', array(), $this->version);
wp_enqueue_script("bootstrap-colorpicker", plugin_dir_url(__FILE__) . 'js/bootstrap-colorpicker.min.js', array(), $this->version);

wp_enqueue_script($this->plugin_name, plugin_dir_url(__FILE__) . 'js/plugnmeet-admin.js', array('jquery'), $this->version, false);
if (preg_match("/plugnmeet/", $hook_suffix) || preg_match("/plug-n-meet/", $hook_suffix)) {
wp_enqueue_script("bootstrap-bundle", plugin_dir_url(__FILE__) . 'js/bootstrap.bundle.js', array(), $this->version);
wp_enqueue_script("bootstrap-colorpicker", plugin_dir_url(__FILE__) . 'js/bootstrap-colorpicker.min.js', array(), $this->version);
wp_enqueue_script($this->plugin_name, plugin_dir_url(__FILE__) . 'js/plugnmeet-admin.js', array('jquery'), $this->version, false);
}

$nonce = wp_create_nonce('ajax_admin');
$script = array('nonce' => $nonce);
Expand Down

0 comments on commit 060bf5e

Please sign in to comment.