WordPress中的内容显示

PHP&MYSQL, Private Project, Solution, WEB & CSS & XHTML, 技巧备忘录 Add comments |

WordPress

内容只显示在你需要的页面

/* If this is a 404 page */
if (is_404()) { ?>
你想显示在404页面的内容代码
/* If this is a category archive */
} elseif (is_category()) {
?>
你想显示在分类页的内容代码
/* If this is a yearly archive */
} elseif (is_day()) { ?>
你想显示在每天归档页的内容代码
/* If this is a monthly archive */
} elseif (is_month()) { ?>
你想显示在每月归档页的内容代码
/* If this is a yearly archive */
} elseif (is_year()) { ?>
你想显示在每年归档页的内容代码
/* If this is a search page */
} elseif (is_search()) { ?>
你想显示在搜索页面的内容代码
/* If this is a monthly archive */
} elseif (isset($_GET[’paged’]) && !empty($_GET[’paged’])) { ?>
你想先是在page的内容代码

/* If this is the frontpage */
if ( is_home() || is_page() ) { ?>
你想显示在首页及其浏览页的内容代码

以上是连续的控制显示内容的代码,如果要分开控制,只要将

/* If this is a *** archive */
} elseif (is_***()) {
?>
换成
/* If this is a *** archive */
if (is_***()) { ?>
然后放入你要显示的内容,最后再写下

封闭代码即可,例如:

/* If this is a category archive */
if (is_category()) { ?>
你想显示在分类页的内容代码

Leave a Reply

You must be logged in to post a comment.


Powered byWordPress 2.6.2 | Theme by N.Design Studio | Processed in 1.09 秒 苏ICP备07500719号

Entries RSS Comments RSS 登录
Links to Page