Read below if you want to start from where I left off in core. But the basic question is: I need to add a “title” attribute to my stylesheets and wp_enqueue_style() doesn’t allow for that parameter, as far as I can tell. Other than a hard embed, are there any ways WordPress allows us to add the title to a stylesheet?
In digging around core I notice that there’s a $title
variable that can be set using $style->extra['title']
.
$title = isset($this->registered[$handle]->extra['title']) ? "title="" . esc_attr( $this->registered[$handle]->extra["title'] ) . "'" : '';
(class.wp-styles.php)
And $title also figures in the filter that is applied when you enqueue a stylesheet. So how can you set that ‘extra’ array within the style object?