fix: resolve warning cannot modify header information on enqueue style.

This commit is contained in:
vnmedeiros 2021-01-20 10:09:32 -03:00
parent 96a0034acd
commit 6fd7a289b7
1 changed files with 7 additions and 3 deletions

View File

@ -21,9 +21,8 @@ class Media {
protected function __construct() {
add_action( 'init', [$this, 'add_attachment_page_rewrite_rule'] );
global $TAINACAN_BASE_URL;
wp_enqueue_style( 'tainacan-media-page', $TAINACAN_BASE_URL . '/assets/css/tainacan-media-page.css', [], TAINACAN_VERSION );
add_action( 'admin_enqueue_scripts', array( &$this, 'add_css' ) );
add_action( 'wp_enqueue_scripts', array( &$this, 'add_css' ) );
add_filter( 'query_vars', [$this, 'attachment_page_add_var'] );
add_action( 'template_redirect', [$this, 'attachment_page'] );
@ -37,6 +36,11 @@ class Media {
);
}
public function add_css() {
global $TAINACAN_BASE_URL;
wp_enqueue_style( 'tainacan-media-page', $TAINACAN_BASE_URL . '/assets/css/tainacan-media-page.css', [], TAINACAN_VERSION );
}
public function attachment_page_add_var($vars) {
$vars[] = 'tainacan_attachment_page';
return $vars;