我想把Wordpress上的存档/分类页面的内容(实际上是整个页面)显示在一个地址中,这个地址是子域。
这是我想看到的,这个页面的内容:http://intorremolinos.co.uk/placecategory/accommodation/下面是示例子域,我希望前面的子域出现在这里:catredi.intorremolinos.co.uk以下是主域名:intorremoinos .co.uk
现在,所有显示的都是与主页相同的东西。
我已经有一些东西,虽然显然它不工作。这是我使用的代码,它在子域文件夹下的index.php文件上。
<?php
/**
* Front to the WordPress application. This file doesn't do anything, but loads
* wp-blog-header.php which does and tells WordPress to load the theme.
*
* @package WordPress
*/
/**
* Tells WordPress to load the WordPress theme and output it.
*
* @var bool
*/
define('WP_USE_THEMES', true);
$_GET['placecategory_id']=56;
/** Loads the WordPress Environment and Template */
require('../wp-blog-header.php');
我有非常有限的PHP知识,你可以想象,希望有人可以帮助。
您应该在index.php的模板文件中写入,这看起来像一个核心文件:
- 前端到WordPress应用程序。这个文件不做任何事情,只是加载
- wp-blog-header.php执行并告诉WordPress加载主题。
所以去你的模板,有几种方法得到你想要的。如果你稍微读一下法典,这段代码应该进入循环,因为它是对类别
的查询条件语句如果你的URL是这样的然后显示placecategory_id=56
<?php
$host = $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
if($host == 'intorremolinos.co.uk/placecategory/accommodation/') {
query_posts("cat=56");
}
?>