type.js中的wordpress循环

时间:2018-02-16 16:34:17

标签: wordpress type.js

如何将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!"],

});});

type.js website

1 个答案:

答案 0 :(得分:0)

你永远无法在JS文件中添加PHP代码,你应该在你的PHP文件中添加带有标记<script>Your JS Code</script>

的JS文件