I created a page template for a list of all posts under a specific category and I am using a code snippet I found on the web which uses $wp_query to list posts. I want to edit the code to list posts under one category and list them alphabetically(in this case the category is called "Anime Reviews" and it's category number is "3"). Unfortunately my knowledge of php is non-existent so I need help with the code to do this.
Here is what I have so far...
<!-- To issue queries I need to hijack $wp_query. So, I can use it later on the page I'm saving it to a temporary variable --> <?php $tempWPQuery = $wp_query; $wp_query = null; // Create a new WP_Query Object $wp_query = new WP_Query(); // Issue a query that returns all posts $wp_query->query('posts_per_page=-1'); // Cycle through all of the posts while ($wp_query->have_posts()): $wp_query->the_post(); ?> <div class="listpost"> <h2><a href="<?php the_permalink(); ?>"> <?php the_title(); ?> </a></h2> </div> <!-- End of listpost --> <?php endwhile; // Reset wp_query to the default $wp_query = null; $wp_query = $tempWPQuery; ?>
Please help :expressionless: