2010-07-02 59 views
0

我在寻找能够检查我们是否在wordpress页面第一页的内容。WordPress的is_first_page()或类似?

我现在的页面看起来像这样:

精选POST 六个最近期的博客。

问题是,当我去/页/ 2我仍然得到特色的职位。我只希望它显示在最前面的页面上。

回答

0

使用get_query_var()

if(get_query_var('page')==1 && is_home()){ 
    // you're on the first page of the blog 
} else { 
    // you're either not on the blog or not on the first page of the blog 
} 

希望有所帮助。

0

is_home()就是你要找的东西......如果你在主页上,它会返回TRUE,如果你在任何其他页面,则返回FALSE。

+0

不正确。 is_home()告诉你,如果你在主博客视图和它的任何页面。韦斯需要知道他是否在主博客视图的第1页。 is_home也会在第2页返回true,所以对Wes几乎没有用处。 – 2010-07-03 13:40:41