is_home() is a very usefull functions in wordpress. just like his name, there use to judge if the page is home page or not, so people can do something special setting in home page from this judge, but sometime, you will fond, it’s not working, is there something wrong? yes, it is. Cause another function name query_posts() be used in this file before is_home() function.

So, if you wont use this function, you must place another named wp_reset_query() before is_home(), like this:

<?php wp_reset_query(); if ( is_home() ) { ?>
I only will display in homepage! really~
<?php } ?>

this is cause when this page call is_home(), it will feedback a bool parameter “ture”, but query_posts() stop it.

anyShare分享到:
          

相关文章

  1. WordPress function bloginfo()
  2. Miniml – Free WordPress Theme
  3. Apache 通过 .htaccess 对目录加密
  4. 自己做了个 wordpress 主题
  5. Lighttp Rewrite Rule For WordPress