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

admin2025-06-06  9

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

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1749217326a317345.html

最新回复(0)