我需要在javascript文件中包含主题文件的路径。我该怎么办?我已经尝试过:
var templateUrl = "<?php get_stylesheet_directory_uri(); ?>";
function LightboxOptions() {
this.fileLoadingImage = "\'"+templateUrl+"/img/loading.gif\'";
this.fileCloseImage = "\'"+templateUrl+"/img/close.png\'";
this.resizeDuration = 700;
this.fadeDuration = 500;
this.labelImage = "Image";
this.labelOf = "of";
}
这并没有给出路径,只是插入<?php get_stylesheet_directory_uri(); ?>
而不是实际路径。有什么想法吗?提前感谢!