$conf, $runtime; function_exists('chdir') AND chdir(APP_PATH); $r = 'mysql' == $conf['cache']['type'] ? website_set('runtime', $runtime) : cache_set('runtime', $runtime); } function runtime_truncate() { global $conf; 'mysql' == $conf['cache']['type'] ? website_set('runtime', '') : cache_delete('runtime'); } register_shutdown_function('runtime_save'); ?>posts - Why do I need to use The Loop on pages (inside page.php etc)?|Programmer puzzle solving
最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

posts - Why do I need to use The Loop on pages (inside page.php etc)?

matteradmin9PV0评论

This question is addition to the following question.
The answers to the linked question say that you have to write THE LOOP inside each php template file, but what is still open is WHY? why is it necessary to write is as part of page.php if this page is not supposed to display any post at all?

another question why when I perform have_posts() inside page.php the return value is 'true'? shouldn't it contain no posts at all in this page?

This question is addition to the following question.
The answers to the linked question say that you have to write THE LOOP inside each php template file, but what is still open is WHY? why is it necessary to write is as part of page.php if this page is not supposed to display any post at all?

another question why when I perform have_posts() inside page.php the return value is 'true'? shouldn't it contain no posts at all in this page?

Share Improve this question asked Oct 31, 2018 at 13:01 GyRoGyRo 1355 bronze badges 1
  • A page is a type of post. – Milo Commented Oct 31, 2018 at 13:21
Add a comment  | 

1 Answer 1

Reset to default 3

The wording is (for historical reasons) a bit confusing. Actually Post can mean two things in WordPress:

  1. The literal Post as in Blog-Post
  2. A general term encompassing other default Post Types (like e.g. Pages) or Custom Post Types.

So there is the Post Type "post" just like there is the Post Type "page".

Here is a link to the Codex which elaborates on that a bit more: https://codex.wordpress/Post_Types

Post a comment

comment list (0)

  1. No comments so far