在 WordPress 之外包含 WordPress 内容 [英] Include WordPress Content Outside of WordPress

查看:21
本文介绍了在 WordPress 之外包含 WordPress 内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望构建 WordPress 网站的移动版本,其中大部分内容都内置在静态文件中,但我正在尝试从移动网站运行的外部 PHP 文件中访问 WordPress 内容.如何在不手动编写 SQL 查询的情况下访问循环或数据库?

I'm looking to build a mobile version of a WordPress site and have most of it built in static files, but am trying to get access to the WordPress content from inside an external PHP file that the mobile site will run from. How can I get access to the loop or database without manually writing SQL queries?

编辑:澄清一下,我在移动版中使用 jqTouch.

Edit: Just to clarify, I'm using jqTouch for the Mobile version.

jqTouch 使用单个 php 文件来显示多个页面"内容,然后通过隐藏/显示内容的 Javascript 进行导航.

jqTouch uses a single php file to display several "pages" of content, which are then navigated via the Javascript hiding/showing the content.

它真正归结为:如何将 WordPress 页面/帖子放入外部 PHP 文件中?

推荐答案

如果您的目标只是让您的网站的第二个版本使用适合移动设备的主题,那么可以使用一个插件来实现这一目标如何?例如:WordPress 移动包

If your goal is to simply have a second version of your site that uses a mobile-friendly theme, how about a plugin that will do this? For example: WordPress Mobile Pack

顺便说一句,我不清楚您要完成什么,因为首先您说您希望移动网站大部分是静态的,但随后您说移动网站将使用 PHP,而 PHP 不是静态的.您能否说明移动网站应该如何运作?

BTW, I'm not clear on what you are looking to accomplish, because first you say you want the mobile site to be mostly static, but then you say that the mobile site will use PHP, which isn't static. Can you clarify how the mobile site should work?

既然我明白了你在做什么,我就想知道如何去做.创建一个包含 WP 循环和 jqTouch 代码的自定义页面模板.然后创建一个使用这个自定义模板的WP页面(如果所有内容都由模板提供,页面内容可以为空).

Now that I get what you're doing, I have a thought as to how you could do it. Create a custom page template that includes the WP loop and the jqTouch code. Then create a WP page that uses this custom template (page content can be blank if all the content is provided by the template).

这篇关于在 WordPress 之外包含 WordPress 内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆