Listing posts from one category in sidebar.php
-
I recently switched themes and now my list of posts for a single category is not working. I have searched the forum and documentation and found alternative solutions, but they did not work.
Here is the code I was using on my previous theme:
<?php query_posts('category_id=10&showposts=12');?> <?php $posts = get_posts('category=10&numberposts=12&offset=0'); foreach ($posts as $post) : start_wp(); ?> <div class="latestvid">» <a href="<?php echo get_permalink() ?>"><?php the_title(); ?></a></div> <?php endforeach; ?>
When copied and pasted into the new theme, all pages and linked posts return with a 404 error.
If I remove the following strand (below), all pages and links return a 404 error, BUT comments will show up.
<?php query_posts('category_id=10&showposts=12');?>
This makes me think that there is an issue with either
query_posts
, and that the main loop is not able to call the post/page content.The only noticeable difference between the coding is that the
get_sidebar
action came AFTER the main loop in the OLD theme. In the new theme, theget_sidebar
action is BEFORE the main loop.Any thoughts, suggestions, or ideas are welcome. The link to my website is https://bigtimerushtv.com/. Let me know if there is more information that you need to help me squash this tricky problem.
- The topic ‘Listing posts from one category in sidebar.php’ is closed to new replies.