Exemplo n.º 1
0
 /**
  * Enqueues the script file.
  *
  * @wp-hook wp_footer
  *
  * @return void
  */
 public function enqueue()
 {
     if (!$this->state->is_active()) {
         return;
     }
     $url = plugin_dir_url($this->file);
     $infix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
     $file = 'assets/css/frontend' . $infix . '.css';
     $path = plugin_dir_path($this->file);
     $version = filemtime($path . $file);
     wp_enqueue_style('that-was-helpful', $url . $file, array(), $version);
 }
Exemplo n.º 2
0
 /**
  * Enqueues the script file.
  *
  * @wp-hook wp_footer
  *
  * @return void
  */
 public function enqueue()
 {
     if (!$this->state->is_active()) {
         return;
     }
     $url = plugin_dir_url($this->file);
     $infix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
     $file = 'assets/js/frontend' . $infix . '.js';
     $path = plugin_dir_path($this->file);
     $version = filemtime($path . $file);
     wp_enqueue_script($this->handle, $url . $file, array('jquery'), $version, TRUE);
     $data = array('action' => $this->action, 'nonce' => $this->nonce, 'url' => admin_url('admin-ajax.php', 'relative'));
     wp_localize_script($this->handle, 'tfThatWasHelpfulData', $data);
 }