[K-BOOM] How does loop typically find correct post?
-
I am trying to add custom post types to this theme and am specifically attempting to create a single-music-review.php file for this music-review custom post type.
When I look up info on “the loop” the codex say the following:
The loop starts here: <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
But unfortunately this doesn’t quite delve into how the loop knows which posts to look for. I am specifically wondering what PHP functions I would use to get WordPress to find the specific post for that page if I’m using a permalink. For instance here is the page on my site:
https://raveisking.danconia.us/music-review/review-glitch-mobs-love-death-immortality-lives-hype/I believe the codex says for get_the_id that it has to be within the loop, and same with get_the_title. So either the codex is wrong or there is some other function that parses the URL or something to that effect. Of course this will create an issue if I ever switch my permalink structure so I want to make sure I get this right before I start tampering away.
- The topic ‘[K-BOOM] How does loop typically find correct post?’ is closed to new replies.