I am having difficulties showing posts ASC by title within each wordpress category. Various code I have found will list alphabetically but returns all posts from the website rather than just the category the user is looking at. I don't want to create multiple category.php files or hardcode which category because I would have to manually set a new file up everytime a category is added to the website. I just want the code to only look in the current category but I do not have the knowledge to code this in.
I am using a standard category.php file with loop.php file. I've removed all the code attempting to re-order the posts but one of the examples I was trying was from this website:
http://wordpress.org/support/topic/display-posts-in-ascending-order
My category.php is this:
<?php get_header(); ?>
     <div class="breadcrumbs">
   <span> <?php if(function_exists('bcn_display'))
    {
        bcn_display();
    }?></span>
</div>
    <!-- section -->
    <div class="area">
    <section role="main">
            <h2><?php single_cat_title();  ?></h2>
        <!--<h2><?php the_category();  ?></h2>-->
         <?php echo category_description( $category_id ); ?> 
        <div class="display-posts-listing">
        <?php get_template_part('loop'); ?>
        </div>
        <?php get_template_part('pagination'); ?>
    </section>
    <!-- /section -->
<?php get_sidebar(); ?>
    </div>
<?php get_footer(); ?>
loop is this:
<?php if (have_posts()): while (have_posts()) : the_post(); ?>
    <!-- article -->
    <div class="listing-item">
    <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    <!-- post title -->
        <h3>
            <?php the_title(); ?>
        </h3>
        <!-- /post title -->
        <!-- post thumbnail -->
        <?php if ( has_post_thumbnail()) : // Check if thumbnail exists ?>
                        <?php the_post_thumbnail('full'); // Declare pixel size you need inside the array ?>
        <?php endif; ?>
        <!-- /post thumbnail -->
        <!-- post details -->
                <!--<span class="author"><?php _e( 'Published by', 'html5blank' ); ?> <?php the_author_posts_link(); ?></span>-->
        <!--<span class="comments"><?php comments_popup_link( __( 'Leave your thoughts', 'html5blank' ), __( '1 Comment', 'html5blank' ), __( '% Comments', 'html5blank' )); ?></span>-->
        <!-- /post details -->
        <?php //html5wp_excerpt('html5wp_index'); // Build your custom callback length in functions.php ?>
        <?php the_content(); ?>
        <?php edit_post_link(); ?>
    </article>
    </div>
    <!-- /article -->
<?php endwhile; ?>
<?php else: ?>
    <!-- article -->
    <article>
        <h2><?php _e( 'Sorry, nothing to display.', 'html5blank' ); ?></h2>
    </article>
    <!-- /article -->
<?php endif; ?>
Thanks
Cathy
 
     
    