如何将WordPress发布循环代码放在type.js中?
$query = get_posts(array(
'showposts' => 3,
'type' => 'news_posts'
));
foreach ($query as $news) :
the_post($news);
endforeach;
type.js:
$(function(){
$(".write").typed({
strings: ["Welcome to ItSolutionStuff.com!"],
});});
答案 0 :(得分:0)
你永远无法在JS文件中添加PHP代码,你应该在你的PHP文件中添加带有标记<script>Your JS Code</script>