skip to Main Content
Menu

Archive Display Problem

I was working on a client’s site.. the client needed the posts (in the archive.php) in the category Math books to sort alphabetically. I found some code

global $query_string;
if (is_category('3'))
{
$posts = query_posts( $query_string . '&cat=3&orderby=title&order=asc&posts_per_page=-1' );
}

and placed it befor the “if (have_posts()) :?>”

Guess what? it didn’t work. I tried it again and again.. trying to wrack my brains as to why. The sorting outcome was
->Making Math Connections: Using Real World Applications for Middle School Students, Second Edition
->10-Minute Critical Thinking Activities for Math

It took me all solutions and all the strength i could muster to find out what was going on.. I even went to the extreme of going into the phpmyadmin of the site to look at the physical records on the database and found nothing.

I went back to editing the page in the wp-admin. And found out that I had a space prior to the word ” Making”. I deleted it and there you go.. the code i used for sorting was in fact working. The only problem was that the entry had a space prior to the actual title.

🙂

Alphonse

Editorial Staff at ETN Multimedia is led by Alphonse Tan. Page maintained by Alphonse Tan

Back To Top