I’ve searched through the forums, and no one (as far as I can tell) has exactly asked how to do what I’m trying to do.
I’m putting together a WordPress site that is meant to be used as a gallery of sorts (using an image associated with each post). The posts would each fall under one of about six categories. I have been able to figure out how to set up a category template page for each of the categories, and I know how to produce a list of all the category’s posts on that template page.
I use this bit of code:
$posts = get_posts('numberposts=4&offset=1&category=1');
foreach($posts as $post) :
<li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
<?php endforeach; ?>
What I would like to be able to do is to have the viewer see each post, and on the side have that list of posts from the same category. Does that make sense?
So, for instance, we could have a category called “Displays”. That category title is in the sidebar. A visitor would click on “Displays”, and the category page comes up. On that category page is a list of all the posts that are about Displays. Then, they could click on one of the post titles, and the full post would appear. However, I still want them to have access to that post list that was on the category page.
Is there a way to use the same code as above, but have it somehow figure out the category the post on that same page is? If that is possible, then it would be a simple change to the single.php/archive.php files.
In case you think this is really odd, I’m trying to do this in order to provide navigation that is not chronologically based. My goal is to end up with a site that doesn’t have “previous” or “next” anywhere on it. I’m using WP as a CMS, more or less, and coming up with a totally custom template. I’m not a PHP jockey, so if I seem to need some hand holding, that’s why.
Thank you in advance for any and all help!
- The topic ‘Single post with it’s own category posts listed’ is closed to new replies.