[英]How to pull content from a Wordpress Category/Archive page and set it up as the index of a subdomain?
我想在Wordpress上提取存檔/類別頁面的內容(實際上是整個頁面)以顯示在一個子域名的地址中。
這是我想看的內容,這個頁面的內容: http ://intorremolinos.co.uk/placecategory/accommodation/這是示例子域名,我希望以前出現在哪里:catredi.intorremolinos.co.uk這里是主要的域:intorremolinos.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中的模板文件中寫入,這看起來像一個核心文件:
所以轉到你的模板,有幾種方法可以獲得你想要的東西。 如果您稍微閱讀了codex,則此代碼應該在循環中,因為它是對類別的查詢
條件語句,如果您的URL如此,則顯示placecategory_id = 56
<?php
$host = $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
if($host == 'intorremolinos.co.uk/placecategory/accommodation/') {
query_posts("cat=56");
}
?>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.