我无法提供根目录链接的正确路径,错误显示" http://localhost/wordpress/alerts.php 404(未找到)" alerts.php文件主题文件夹主目录。
.directive('alertsCenter', function () {
return {
templateUrl: 'alerts.php',
replace:true,
restrict: 'E',
controller:'alertsCtrl'
};
});
答案 0 :(得分:0)
试试这个:
如果您在活动主题文件夹
中添加了文件,请使用get_template_directory()
功能
function print_my_inline_script() {
if ( wp_script_is( 'some-script-handle', 'done' ) ) {
?>
<script type="text/javascript">
//PASTE YOUR ALL JAVASCRIPT CODE
.directive('alertsCenter', function () {
return {
templateUrl: '<?php echo get_template_directory(); ?>/alerts.php',
replace:true,
restrict: 'E',
controller:'alertsCtrl'
};
});
</script>
<?php
}
}
add_action( 'wp_footer', 'print_my_inline_script' );