• Hi
    I have an archive page that lists all my posts in alphabetical order. Is there a way to make it ignore the “The” in posts names?

    <?php
    if(isset($wp_query->query_vars['category_name']))
    {
    	$cat = urldecode($wp_query->query_vars['category_name']);
    }
    query_posts('category_name='.$cat.'&showposts=-1&orderby=title&order=asc');
    ?>
    <a name="top"></a>
    <ul id="archive">
    <?php $count = 0; $newLetter = ''; ?>
    <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
    	<?php
    	$count++;
    	$oldLetter = $newLetter;
    	$newLetter = substr(the_title('','',false), 0, 1);
    	if(strtolower($oldLetter) != strtolower($newLetter))
    	{
    		if($count != 1)
    			echo '<li class="entry-title" style="text-align:right"><a href="#top">Go To Top</a></li></ul></li>';
    		echo '<li><h2><a name="'.$newLetter.'"> </a>'.$newLetter.'</h2><ul>';
    	}
    	?>
    
    	<li class="entry-title"><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></li>
    	<?php endwhile; // end of the loop. ?>
    
    </ul>
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Ignore "The" In Alphabetical Archives’ is closed to new replies.