Loop activated on page ID
-
What I’m trying:
Creating different pages on the normal page template. I’m trying to edit that page template, so that it reads the page ID and activates a different loop.Example: I create a page called ‘Sales’ with the page ID of 59. This activates a loop which reads the category ‘Sales’. See below for the exact code:
<?php the_post() ?> <?php query_posts('category_name=Sales&posts_per_page=5'); ?> <?php while (have_posts()) : the_post(); ?> <?php the_title() ?> <?php the_content() ?> <?php endwhile;?>
Then I create a different page called, for example, ‘Store’ which activates a different loop with posts from the catogery ‘Store’.
So my question is, how can I write some sort of If Else statement that reads the page ID and activates the loop that belongs to that page?
Thanks in advance!
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Loop activated on page ID’ is closed to new replies.