• Does anyone know how to list these posts alphabetically? I’ve tried a number of things and nothing seems to work?

    I also need 2 posts excluding so if anyone knows how to do that also it would be great.

    Code:

    <?php query_posts( array('cat' => $category_id,'posts_per_page'=>'-1', 'orderby'=> 'title', 'order' => 'ASC')); ?>
    		<ul id="ulposts2">
    		<?php while ( have_posts() ) : the_post();
    		    echo '<li';
    		    if (($ID = get_the_ID()) == $pagepostid) echo ' class="proadv-current-item"';
    		    //else echo ' class="post-id'.$ID.'-id'.$pagepostid.'"';
    		    echo '>';
                echo '<div class="sponsor-thumb">';
                the_post_thumbnail( 'category-thumb' );
                echo '</div>';
    		    echo '<a href="'.get_permalink().'">';
    		    the_title();
    		    echo '</a>';
    		    echo '';
    		endwhile; ?>
    
    		<?php wp_reset_query(); ?>

    [Moderator Note: Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum’s parser.]

The topic ‘Sort posts alphabetically and exlude posts’ is closed to new replies.