1
我想在管理端用聚合物建立wordpress插件。聚合物使用鏈接元素來導入庫。但是缺少設置rel屬性的wp函數「wp_enqueue_style」。這是從官方文檔(link):WordPress的功能wp_enqueue_style缺失rel參數
wp_enqueue_style($ handle,$ src,$ deps,$ ver,$ media);
有一個名爲「wp_style_add_data」的功能,但我想設置這樣rel屬性沒有任何的運氣:
wp_enqueue_style('polymer_html', plugin_dir_url(__FILE__).'../js/bower_components/polymer/polymer.html', array(), '1.0', 'all');
wp_style_add_data('polymer_html', 'rel', 'import'); //this way
wp_style_add_data('polymer_html', 'import', true); //and also this way
這裏是例如導入聚合物:
<link rel="import" href="bower_components/polymer/polymer.html">
我很久以前就開發了wp插件,所以我希望你能幫忙找到一個解決這個限制的最佳解決方案。