WordPressã§query_postsã使ã£ããã¼ã¸éãã§Not Foundã«ãªã件
WordPressã§ãä¸è¨ã®ããã«ãquery_postsã使ã£ã¦1è¨äºãããã«è¡¨ç¤ºããã¨ã³ããªã¼æ°ãè¨å®ãããã¼ã¸ã®ãã¼ã¸éãã§ã次ã®ãã¼ã¸ããNot Foundã«ãªã件ã§ããï¼ãããããã¦ããã¾ããï¼ã
<?php query_posts($query_string .'&posts_per_page=表示ãããã¨ã³ããªæ°'); ?>
ã©ããããä¸è¨ã®ãããªãã¨ãèµ·ãã£ã¦ãã¿ããã§ãã
ãã¨ãã°ãå ¨é¨ã§10件ã®æ稿è¨äºãããã«ãã´ãªã§ 管çç»é¢ã§ã®è¨å®ãã¼ã¸ããã10件ã«ãªã£ã¦ãã®ã«ã çºè¡ã¯ã¨ãªã§ã¯ä»¥ä¸ã®ããã«2件ã ã£ãå ´åã$numPerPage = 2; if (have_posts()) :
query_posts($query_string.'&posts_per_page='.$numPerPage.'&cat=7');çºè¡ã¯ã¨ãªãã¼ã¹ã§èããã¨å ¨é¨ã§5ãã¼ã¸ï¼2件/1ãã¼ã¸ï¼ã®ã¢ã¼ã«ã¤ããçæãããã¨æã£ã¦ãã å®éã¯2ãã¼ã¸ç®ä»¥éãnot foundã«ãªãããã§ãã ããããããªãã§ããã1ãã¼ã¸ç®ã§è¨å®ã«åºã¥ãã¦10件ã¨ã£ã¦ãã¾ããã§ã表示ãããã®ã¯ã¯ã¨ãªè¨å®ãã 2件ã®ã¿ã¨ããç¶æ ã«ãªãã¿ããã§ããã ããã°ã©ã ã§ç´æ¸ããã¦ã2件ã¨ããè¨å®ãã管çç»é¢ã§ã®è¨å®ãåªå ãããã¨è¨ããã¨ã§ããã
ãããæ£ç´ä½è¨ã£ã¦ãã®ãããããªããã§ãããçµå±ã®ã¨ãããquery_postsã§1è¨äºãããã«è¡¨ç¤ºããã¨ã³ããªã¼æ°ãã«ãã´ãªã¼ããã¿ã°ãã¨ã«è¨å®ãã¦ããã¤ã管çç»é¢ã®ã表示è¨å®ãï¼ã1ãã¼ã¸ã«è¡¨ç¤ºããæ大æ稿æ°ããquery_postsã®æ大æ°ãããå¤ãè¨å®ãã¦ããã¤ããã®ã«ãã´ãªã¼ã®è¨äºæ°ãã次ã®ãã¼ã¸ã®æ大ãæºãããªãå ´åã«èµ·ãããããªã®ã§ãï¼ãã®è¾ºã¯ææ§ã§ãï¼ï¼ã
ä¾ãã°ãããããããã¨ããã«ãã´ãªã¼ã§è¡¨ç¤ºããè¨äºã®æ°ãquery_postsã§ã5件ãã¨ãã¦ãæ稿æ°ãã¾ã 7件ã ã£ãããããã管çç»é¢ã®è¨å®ã§ã¯ã10件ãã¨ãã¦ãããã¨ãã£ãæã«ããããããã次ã®ãã¼ã¸ãè¨äºæ°è¶³ãã²ãããä½ãã¸ããããã¨ãããã¨ã§ãèµ·ããããã§ãã
ãªã®ã§ã管çç»é¢ã®è¨å®ãã1ãã«ãã¦ãããããã®æ稿æ°ã«ç´°ããè¨å®ããã°ã¡ããã¨ãã¼ã¸éããæ©è½ããã¿ãããªã®ã§ãããã©ããªãã§ãããããã¨ãããããåã¯ããã§è§£æ±ºãã¾ããã