Support » Fixing WordPress » The Eternal Quesion: How to view one category post at a time, with navigation
7 years, 8 months ago
Well, I’ve seen this asked on this forum and other places on the web dozens of times but with no real answers, even though it seems like it would be straightforward in WP.
Question: How do I set up a page that shows:
1) Only 1 post at a time
2) From only a specific category
3) While maintaining usable navigation links to go to previous posts (in that category)
Now hopefully this isn’t obvious to me because I’m new to WP and PHP, but it seems like there are others who have the same question.
Ideally what I’d like to have explained is:
– what the best approach for this is
– some example code — in and around The Loop
– what is the structure of the URL needed to reach this page
My current WP sandbox environment is behind a firewall, so I can’t show a page, but if that’s a deal-breaker I’ll work something out.
Thanks in advance for anyone who even answers this.
7 years, 5 months ago
1. Create a category template (ie. category-7.php)
2. Use your main index template as your guide
3. Insert something like this above your if have posts statement, replacing the category # with yours:
<?php $page = (get_query_var('paged')) ? get_query_var('paged') : 1; query_posts("cat=7&posts_per_page=1&paged=$paged"); ?>