我有一个自托管的 WordPress 博客,我正在为我的网站制作一个基于 jQuery 的静态主页。
因此,我想在我的主页(小部件中)上显示我的博客中的一些内容作为新闻部分。
例如,我可以获取
- 最新的五个帖子的标题和内容
- 或特定的页面内容(通过传递页面 id)
- 或特定的帖子(通过传递帖子 id)
那么 WordPress 是否包含任何将帖子内容显示为的 PHP 文件纯文本,还是 HTML?
我想过获取博客的 RSS,然后将其显示在页面上,但 RSS 并没有提供帖子的完整内容。
I have a self-hosted WordPress blog, and I am making a static home page for my website based on jQuery.
So, I wanted to display some content from my blog, on my home page (in widgets), as a news section.
For example, I may fetch
- the latest five posts' titles and content
- OR a specific page content (via passing the page id)
- OR a specific post (via passing the post id)
So does WordPress include any PHP file that shows the posts contents as plain text, or HTML?
I thought about fetching the blog's RSS, and then show it on the page, but the RSS doesn't provide the full content of the post.
发布评论
评论(2)
如果托管在同一服务器上,您可以通过包含
wp- 来将 WordPress 集成到您的应用中blog-header.php
,然后使用get_posts() >setup_postdata()
。例如:
If it's hosted on the same server, you could integrate WordPress into your app by including
wp-blog-header.php
, and then call get_posts(), usingsetup_postdata()
.For example:
看看雅虎!管道。
Take a look at Yahoo! Pipes.