Wordpress 我怎样才能在我的网站';s的主页?
编辑:我的问题是,如何在我自己网站的主页上列出另一个网站的rss源,这样当访问者点击其中任何一个列表时,它会将访问者引导到我获取这些rss源的网站?你可以使用emberjs从wordpress获取帖子 App.jsWordpress 我怎样才能在我的网站';s的主页?,wordpress,post,fetch-api,auto,Wordpress,Post,Fetch Api,Auto,编辑:我的问题是,如何在我自己网站的主页上列出另一个网站的rss源,这样当访问者点击其中任何一个列表时,它会将访问者引导到我获取这些rss源的网站?你可以使用emberjs从wordpress获取帖子 App.js App = Ember.Application.create(); App.Router.map(function() { this.resource('about'); this.resource('posts', function() { thi
App = Ember.Application.create();
App.Router.map(function() {
this.resource('about');
this.resource('posts', function() {
this.resource('post', {path: ':post_id'});
});
});
App.PostsRoute = Ember.Route.extend({
model: function() {
return $.getJSON('http://wordpresssite/api/get_recent_posts/?callback=?').then(function(data) {
return data.posts.map(function(post) {
post.body = post.content;
return post
});
});
}
});
App.PostRoute = Ember.Route.extend({
model: function(params){
return posts.findBy('id', params.post_id);
}
});
App.PostController = Ember.ObjectController.extend({
isEditing: false,
actions: {
edit: function(){
this.set('isEditing', true);
},
doneEditing: function() {
this.set('isEditing', false);
}
}
});
Ember.Handlebars.helper('format-date', function(date){
return moment(date).fromNow();
});
var showdown = new Showdown.converter();
Ember.Handlebars.helper('format-markdown', function(input) {
return new Handlebars.SafeString(showdown.makeHtml(input));
});
index.html
<script type="text/x-handlebars">
<div class="navbar">
<div class="navbar-inner">
<a class="brand" href="#">Bloggr</a>
<ul class="nav">
<li>{{#link-to 'posts'}}Posts{{/link-to}}</li>
<li>{{#link-to 'about'}}About{{/link-to}}</li>
</ul>
</div>
</div>
{{outlet}}
</script>
<script type="text/x-handlebars" id="posts">
<div class='container-fluid'>
<div class='row-fluid'>
<div class='span3'>
<table class='table'>
<thead>
<tr><th>Recent Posts</th></tr>
</thead>
{{#each}}
<tr><td>
{{#link-to 'post' this}}
{{title}} <small class='muted'>by {{author.name}}</small>
{{/link-to}}
</td></tr>
{{/each}}
</table>
</div>
<div class="span9">
{{outlet}}
</div>
</div>
</div>
</script>
<script type="text/x-handlebars" id="post">
{{#if isEditing}}
{{partial 'post/edit'}}
<button {{action 'doneEditing'}}>Done</button>
{{else}}
<button {{action 'edit'}}>Edit</button>
{{/if}}
<h1>{{title}}</h1>
<h2>by {{author.name}} <small class='muted'>({{format-date date}})</small></h2>
<hr>
<div class='intro'>
{{format-markdown excerpt}}
</div>
<div class='below-the-fold'>
{{format-markdown body}}
</div>
</script>
<script type="text/x-handlebars" id="post/_edit">
<p>{{input type="text" value=title}}</p>
<p>{{input type="text" value=excerpt}}</p>
<p>{{textarea value=body}}</p>
</script>
<script type="text/x-handlebars" id="about">
<div class='about'>
<p>This is my first Ember.js website. Going to see how it all of this works</p>
</div>
</script>
<script src="js/libs/handlebars-1.0.0.js"></script>
<script src="js/libs/ember-1.0.0.js"></script>
<script src="js/app.js"></script>
- {{{链接到'帖子'}帖子{{/链接到}
- {{{链接到'about'}}关于{{/链接到}
{{outlet}}
最近的职位
{{{#各}
{{{#链接到'post'this}
{{title}}作者{author.name}
{{/链接到}
{{/每个}}
{{outlet}}
{{#如果是编辑}
{{partial'post/edit'}
多恩
{{else}
编辑
{{/if}
{{title}}
作者:{{author.name}}({{format date}})
{{格式标记摘录}
{{format markdown body}
{{input type=“text”value=title}
{{input type=“text”值=摘录}
{{textarea value=body}
这是我的第一个Ember.js网站。去看看这一切是如何运作的
我希望这对你有帮助
欢迎使用堆栈溢出!其他用户将您的问题标记为低质量和需要改进。我对您的输入进行了重新措辞/格式化,使其更易于阅读/理解。请查看我的更改,以确保它们反映您的意图。但我认为你的问题仍然无法回答。你现在应该回答你的问题,包括你自己的努力(参见)。如果您有进一步的问题或反馈,请随时给我留言。