I saw that someone had asked how to add attributes in script tag for 3rd party JS here: Adding Additional Attributes in Script Tag for 3rd party JS
My question is how to also make those attributes dynamic if I were to write a WordPress plugin that would take in a value that the user inputs via a widget.
The script_loader_tag
filter only takes in 3 preset parameters ($handle, $tag, $src) so I can’t figure out how to add in custom params to the $tag = str_replace( 'src=', 'data-attribute="'.$dynamicvar.'" src=', $tag );
from the parent function it’s contained in.
Any help would be appreciated
- Hiện tại chúng tôi có hơn 25 nghìn bài văn mẫu các thể loại.
- Kho tài liệu, đề thi học sinh giỏi các lớp vô cùng phong phú.
- Mỗi ngày cập nhật hơn 100 đề thi chất lượng từ các website bán tài liệu lớn.
Tải đề thi VIP với giá siêu rẻ tại Vip.Dethihsg247.Com